(MacOSX10.8, PHP5.3, CakePHP2.4.2)
$ mkdir example-app $ cd example-app $ emacs composer.json
composer.json
{ "name": "example-app", "repositories": [ { "type": "pear", "url": "http://pear.cakephp.org" } ], "require": { "pear-cakephp/cakephp": ">=2.4.2" }, "config": { "vendor-dir": "Vendor/" } }
インストール composer
$ curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off $ php composer.phar install
プロジェクト作成
$ Vendor/bin/cake bake project app
修正
webroot/index.php
: define( 'CAKE_CORE_INCLUDE_PATH', /* ROOT . DS . APP_DIR . '/Vendor/pear-pear.cakephp.org/CakePHP' */ ROOT . DS . 'Vendor/pear-pear.cakephp.org/CakePHP'); :
install DebugKit plugin
修正
- composer.json
{ "name": "example-app", "repositories": [ { "type": "pear", "url": "http://pear.cakephp.org" } ], "extra": { "installer-paths": { "app/Plugin/DebugKit": ["cakephp/debug_kit"] } }, "require": { "pear-cakephp/cakephp": ">=2.4.2", "cakephp/debug_kit": "2.2.*" }, "config": { "vendor-dir": "Vendor/" } }
$ php composer.phar update
追加
- app/Config/bootstrap.php
: CakePlugin::loadAll();
あとは公式チュートリアルの『ブログデータベースの作成』あたり以降をやる
bake 使って速攻
bake all やると モデル・コントローラ・ビュー・テストが一気にできる
$ app/Console/cake bake all