Phalcon Developer Tools

本文节选自《Netkiller PHP 手札》

http://netkiller.github.io/php/index.html


8.4.1.4. Phalcon Developer Tools

# pear channel-discover pear.phalconphp.com
# pear install phalcon/Devtools

运行 phalcon 测试是否正确安装

# phalcon

Phalcon DevTools (2.0.7)

Help:
  Lists the commands availables in Phalcon devtools

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

8.4.2. DevTools

8.4.2.1. 创建项目

# phalcon project --help

Phalcon DevTools (2.0.7)

Help:
  Creates a project

Usage:
  project [name] [type] [directory] [enable-webtools]

Arguments:
  help	Shows this help text

Example
  phalcon project store simple

Options:
 --name               Name of the new project
 --enable-webtools    Determines if webtools should be enabled [optional]
 --directory=s        Base path on which project will be created [optional]
 --type=s             Type of the application to be generated (micro, simple, multi-module)
 --template-path      Specify a template path [optional]
 --use-config-ini     Use a ini file as configuration file [optional]
 --trace              Shows the trace of the framework in case of exception. [optional]
 --help               Shows this help

创建test项目

# phalcon project test

Phalcon DevTools (2.0.7)

  Success: Controller "index" was successfully created.
  Success: Project "test" was successfully created.
[root@netkiller example.com]# phalcon project www.example.com

Phalcon DevTools (2.0.7)


  Success: Controller "index" was successfully created.


  Success: Project "www.example.com" was successfully created.


[root@netkiller example.com]# find www.example.com/
www.example.com/
www.example.com/app
www.example.com/app/logs
www.example.com/app/views
www.example.com/app/views/index
www.example.com/app/views/index/index.phtml
www.example.com/app/views/layouts
www.example.com/app/views/index.phtml
www.example.com/app/config
www.example.com/app/config/config.php
www.example.com/app/models
www.example.com/app/controllers
www.example.com/app/controllers/ControllerBase.php
www.example.com/app/controllers/IndexController.php
www.example.com/public
www.example.com/public/img
www.example.com/public/css
www.example.com/public/temp
www.example.com/public/files
www.example.com/public/js
www.example.com/public/index.php
www.example.com/public/.htaccess
www.example.com/.phalcon
www.example.com/.htaccess
www.example.com/index.html

8.4.2.2. 创建控制器

# phalcon controller sample

Phalcon DevTools (2.0.7)

  Success: Controller "sample" was successfully created.
# cat app/controllers/SampleController.php
<?php

class SampleController extends \Phalcon\Mvc\Controller
{

    public function indexAction()
    {

    }

}

Phalcon Developer Tools

你可能感兴趣的:(PHP,neo,陈景峰,netkiller,phalcon)