FuelPHP の開発環境を構築する

クイックインストーラをインストールする

$ curl get.fuelphp.com/oil | sh

プロジェクトを作成する

今回は fuel-sample というプロジェクトを作成します。

$ oil create fuel-sample

こんなエラーが

Error - date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In 
case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set  
date.timezone to select your timezone. in COREPATH/classes/fuel.php on line 161
# /usr/local/etc/php/5.4/php.ini

[Date]
;date.timezone =
↓
date.timezone = Asia/Tokyo

このPCでPHPの開発やってなかったのでphp.iniの設定してなかったです^^;

開発を始める前に

Gitの管理ファイルは、FuelPHPのコアおよびパッケージ用になっているので削除する

$ rm -rf .git .gitmodules *.md docs fuel/core fuel/packages

Gitリポジトリを初期化する

$ git init

Gitサブモジュールを追加を追加します

$ git submodule add git://github.com/fuel/docs.git docs
$ git submodule add git://github.com/fuel/core.git fuel/core
$ git submodule add git://github.com/fuel/auth.git fuel/packages/auth
$ git submodule add git://github.com/fuel/email.git fuel/packages/email
$ git submodule add git://github.com/fuel/oil.git fuel/packages/oil
$ git submodule add git://github.com/fuel/orm.git fuel/packages/orm
$ git submodule add git://github.com/fuel/parser.git fuel/packages/parser

Gitサブモジュールを更新する

$ git submodule foreach 'git pull'
$ git submodule foreach 'git checkout 1.7/master' # バージョンを指定する場合はこっち

コミットする

$ git remote add origin [リポジトリのURL]
$ git add .
$ git commit -m "first commit"
$ git push origin master

clone する場合

$ git clone [リポジトリのURL]
$ git submodule init && git submodule update

公開ディレクトリへシンボリックリンクを作成する

$ ln -s ~/dev/php/fuel-sample/public ~/Sites/fuel-sample

Apache の設定

# /usr/local/etc/apache2/httpd.conf

<VirtualHost *:80>
  DocumentRoot /Users/demo/Sites/fuel-sample
  ServerName localhost
  <Directory "/Users/demo/Sites/fuel-sample">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
$ sudo apachectl restart

f:id:kzy52:20140223230931p:plain

これで開発に入れます!