最麻煩的安裝…
Phalcon Extension
Mac
使用 homebrew 安裝
brew install php54-phalcon
brew install php55-phalcon
brew install php56-phalcon
brew install php70-phalcon
測試
echo "<?php echo Phalcon\Version::get() . \"\n\"; ?>" | php
3.0.0
Ubuntu
安裝
sudo apt-get install php5-dev libpcre3-dev gcc make
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build && git checkout v3.0.0 && ./install
sudo echo "extension=phalcon.so" > /etc/php5/cli/conf.d/30-phalcon.ini
測試
echo "<?php echo Phalcon\Version::get() . \"\n\"; ?>" | php
3.0.0
Vagrant
使用 Vagrant 建置環境
官方有提供 Vagrant 環境版
也可以配合上面 Ubuntu 安裝 script
Vagrant.configure(2) do |config| |
Docker
可參考其他人做的 image
或是自己寫 Dockerfile
範例:
FROM php:7.0 |
compile 2.x 時,記憶體需設定 2G 以上才能成功
測試
docker run -it --rm phalon-image bash
echo "<?php echo Phalcon\Version::get() . \"\n\"; ?>" | php
3.0.0
Phalcon Developer tools
要使用開發者工具前,要先安裝好上面的 [Extension](#Phalcon Extension)。
如果要當全域指令,建議用 Git 下載;如果沒有的話,建議使用 Composer 下載
Git
安裝與測試
$ git clone https://github.com/phalcon/phalcon-devtools
$ ln -s ./phalcon-devtools/phalcon.php /usr/local/bin/phalcon
$ phalcon
Phalcon DevTools (3.0.0)
Available commands:
commands (alias of: list, enumerate)
controller (alias of: create-controller)
module (alias of: create-module)
model (alias of: create-model)
all-models (alias of: create-all-models)
project (alias of: create-project)
scaffold (alias of: create-scaffold)
migration (alias of: create-migration)
webtools (alias of: create-webtools)
Composer
定義檔
{ |
安裝與測試
composer install
php vendor/bin/phalcon.php
Phalcon DevTools (3.0.0)
Available commands:
commands (alias of: list, enumerate)
controller (alias of: create-controller)
module (alias of: create-module)
model (alias of: create-model)
all-models (alias of: create-all-models)
project (alias of: create-project)
scaffold (alias of: create-scaffold)
migration (alias of: create-migration)
webtools (alias of: create-webtools)
或是直接裝 global
composer global require phalcon/devtools=3.0.0