1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【CakePHP】git cloneして開発環境構築

Posted at

0. はじめに

大阪の受託開発エンジニアの、kazumakishimoto(@kazuma_dev)です!
CakePHPプロジェクトをgit cloneして、vendor.env,app_local.phpファイルを作ってbin/cake serverするまでのメモです!

0-1. 目次

1.環境構築
2.初期設定
Reference

0-2. 前提条件

  • Gitインストール済み
  • GitHub登録済み

0-3. 開発環境

key value
OS macOS
FW CakePHP
バーション管理 Git/GitHub
パッケージ管理 Composer

1. 環境構築

1-1. git clone

local
$ mkdir cakephp
$ cd cakephp
$ git clone https://github.com/xxxxxxxxxxxxxxx/xxxx.git

1-2. vendor

local
$ composer install

1-3. 動作確認

local
$ bin/cake server

2. 初期設定

2-1. config

local
$ cp .env.example .env
$ cp app_local.example.php app_local.php
config/.env
export APP_NAME="hoge"
export APP_DEFAULT_LOCALE="ja_JP"
export APP_DEFAULT_TIMEZONE="Asia/Tokyo"
export SECURITY_SALT="__SALT__" 
config/bootstrap.php
if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {
    $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']);
    $dotenv->parse()
        ->putenv()
        ->toEnv()
        ->toServer();
}
config/app_local.php
    'Datasources' => [
        'default' => [
            'host' => 'localhost',
            'username' => 'root',
            'password' => '',
            'database' => 'hoge',
            'url' => env('DATABASE_URL', null),
        ],
config/app.php
'App' => [
    'encoding' => env('APP_ENCODING', 'UTF-8'),
    'defaultLocale' => env('APP_DEFAULT_LOCALE', 'ja_JP'),
    'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'Asia/Tokyo'),
],

'Datasources' => [
    'default' => [
        'timezone' => 'Asia/Tokyo',
        'quoteIdentifiers' => true,
    ],
],

2-2. migration

local
$ bin/cake migrations migrate
$ bin/cake migrations seed

Reference

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?