# phalcon-devtools **Repository Path**: Wu_mao/phalcon-devtools ## Basic Information - **Project Name**: phalcon-devtools - **Description**: 继承于phalcon-devtools,支持phalcon5.0+ - **Primary Language**: PHP - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-07-24 - **Last Updated**: 2024-08-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Phalcon Devtools [![codecov](https://codecov.io/gh/phalcon/phalcon-devtools/branch/4.0.x/graph/badge.svg)](https://codecov.io/gh/phalcon/phalcon-devtools) [![Latest Version](https://img.shields.io/packagist/v/phalcon/devtools.svg?style=flat-square)][:devtools:] [![Software License](https://img.shields.io/badge/license-BSD--3-brightgreen.svg?style=flat-square)][:license:] [![Total Downloads](https://img.shields.io/packagist/dt/phalcon/devtools.svg?style=flat-square)][:packagist:] [![Daily Downloads](https://img.shields.io/packagist/dd/phalcon/devtools.svg?style=flat-square)][:packagist:] [![Build Status](https://api.travis-ci.org/phalcon/phalcon-devtools.svg?branch=master)][:travis:] ![Phalcon WebTools](http://i.imgur.com/B3V2uSf.png) ## What's Phalcon? Phalcon PHP是一个以C扩展形式提供的web框架,提供了高性能和更低的资源消耗。 ## What are Devtools? 本工具为您提供了好用的脚本来生成代码,帮助开发与Phalcon框架一起使用的更快、更简单的应用程序。 ## Requirements * PHP >= 7.4 * Phalcon >= 5.0.0 ## 版本来源 基于: - https://github.com/phalcon/phalcon-devtools.git - https://github.com/daleffe/phalcon-devtools-5.x-fixed.git - 两个主分支的修改和优化,使用phalcon/migrations v3.0.1+ ## Installing via Composer Install composer in a common location or in your project: ```bash curl -s http://getcomposer.org/installer | php ``` 因https://packagist.phpcomposer.com 不好使,换composer源: ```bash composer config -g repos.packagist composer https://mirrors.tencent.com/composer/ composer clearcache ``` Create the composer.json file as follows: ```json { "require-dev": { "phalcon/devtools": "~5.0" } } ``` If you are still using Phalcon 3.4.x, create a `composer.json` with the following instead: ```json { "require-dev": { "phalcon/devtools": "^3.4" } } ``` Run the composer installer: ```bash php composer.phar install ``` ## Build `.phar` Install composer and box in a common location or in your project: ```bash curl -s http://getcomposer.org/installer | php bin/composer install ``` Build phar file `phalcon-devtools` ```bash bin/box build -v chmod +xr ./phalcon.phar # Test it! php ./phalcon.phar ``` ## Installation via Git Phalcon Devtools can be installed by using Git. Just clone the repo and checkout the current branch: ```bash cd ~ git clone https://gitee.com/Wu_mao/phalcon-devtools.git cd phalcon-devtools ``` This method requires a little bit more of setup. Probably the best way would be to symlink the `phalcon` file to a directory in your `PATH`, so you can issue phalcon commands in each directory where a phalcon project resides. ```bash cd phalcon-devtools composer install ln -s $(pwd)/phalcon /usr/bin/phalcon chmod ugo+x /usr/bin/phalcon ``` If you get a `"phalcon: command not found"` message while creating the symlink, make an alias. ```bash alias phalcon=/home/[USERNAME]/phalcon-devtools/phalcon ``` ## Usage To get a list of available commands just execute following: ```bash phalcon commands help ``` This command should display something similar to: ```sh $ phalcon --help Phalcon DevTools (5.0.0) Help: Lists the commands available in Phalcon DevTools Available commands: info (alias of: i) 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) serve (alias of: server) console (alias of: shell, psysh) ``` ## Database adapter Should add `adapter` parameter in your `db` config file (if you use not MySQL database). For PostgreSQL it will be something like: ```php $config = [ 'host' => 'localhost', 'dbname' => 'my_db_name', 'username' => 'my_db_user', 'password' => 'my_db_user_password', 'adapter' => 'Postgresql' ]; ``` ## Configuration file By creating **config.json** or any other configuration file called **config** in root project you can set options for all possible commands, for example: ```json { "migration" : { "migrations": "App/Migrations", "config": "App/Config/db.ini" }, "controller" : { "namespace": "Phalcon\\Test", "directory": "App/Controllers", "base-class": "App\\MyAbstractController" } } ``` And then you can use `phalcon migration run` or `phalcon controller SomeClass` and those commands will be executed with options from file. Arguments provided by developer from command line will overwrite existing one in a file. ## License Phalcon Developer Tools is open source software licensed under the [New BSD License][:license:].
© Phalcon Framework Team and contributors [:packagist:]: https://packagist.org/packages/phalcon/devtools [:devtools:]: https://github.com/phalcon/phalcon-devtools [:license:]: https://github.com/phalcon/phalcon-devtools/blob/master/LICENSE.txt [:travis:]: https://travis-ci.org/phalcon/phalcon-devtools