LoginSignup
11
11

More than 5 years have passed since last update.

PHPフレームワークphalconのディベロッパーツールを使ってみる

Posted at

昨日に続いて、今日は開発者ツールを使ってみます。
昨日の内容は以下のリンクとなります。
PHPフレームワークのphalconをeclipseで使ってみる

作業場所

vagrantにて作業を行います。
phalconのサイトで提示されているvagrantを利用するといいと思います。
http://phalconphp.com/ja/download/vagrant

コマンドラインで利用するPHPにphalconを使えるようにする

vagrantを作成した段階ではブラウザではphalconが利用できるのですが、コマンドラインだと利用できない状態です。
/etc/php5/cli/php.iniにphalcon.soを追加します。

extension=phalcon.so

ディベロッパーツールを使う

昨日書いたディベロッパーツールの作業を終えた段階で、以下を実行します。

vagrant@precise32:/vagrant$ phalcon commands

Phalcon DevTools (1.2.5)

Available commands:
  commands (alias of: list, enumerate)
  controller (alias of: create-controller)
  model (alias of: create-model)
  all-models (alias of: create-all-models)
  project (alias of: create-project)
  scaffold
  migration
  webtools

phalconのコマンドラインが使えるようになっていればOKです。

プロジェクトスケルトンの生成

phalcon project [name]でプロジェクトを作成できます。

vagrant@precise32:/vagrant$ phalcon project test

Phalcon DevTools (1.2.5)


  Success: Controller "index" was successfully created.


  Success: Project 'test' was successfully created.

ディレクトリはこんな感じのものができています。

vagrant@precise32:/vagrant/test$ tree
.
|-- app
|   |-- cache
|   |-- config
|   |   |-- config.php
|   |   |-- loader.php
|   |   `-- services.php
|   |-- controllers
|   |   |-- ControllerBase.php
|   |   `-- IndexController.php
|   |-- models
|   `-- views
|       |-- index
|       |   `-- index.volt
|       |-- index.volt
|       `-- layouts
|-- index.html
`-- public
    |-- css
    |-- files
    |-- img
    |-- index.php
    |-- js
    `-- temp

app/cacheに書き込み権限が無いとエラーになることがあるので注意しましょう。

cd app
chmod -R 777 cache

ブラウザにアクセスし、Congratulations!が表示されれば成功です。
私の環境では以下のURLにて表示されます。
http://192.168.100.20/test

webtoolを利用する

webtoolがあるようなので、適用してみます。
web上でControllerやModelの作成、Scaffoldの作成などが出来るようです。

vagrant@precise32:/vagrant/test$ phalcon webtools enable

Phalcon DevTools (1.2.5)


  Success: Webtools successfully enabled!

以下のURLにアクセスすると、Phalcon Web Toolsが表示されると思います。
http://192.168.100.20/test/webtools.php

とりあえず、今日はこの辺で失礼します。

11
11
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
11
11