Cilex:一个轻量级的框架创建PHP CLI脚本

网友投稿 1020 2022-10-28

Cilex:一个轻量级的框架创建PHP CLI脚本

Cilex:一个轻量级的框架创建PHP CLI脚本

Cilex, a simple Command Line Interface framework

Cilex is a simple command line application framework to develop simple tools based on Symfony2 components:

command(new \Cilex\Command\GreetCommand());$app->command('foo', function ($input, $output) { $output->writeln('Example output');});$app->run();

Cilex works with PHP 5.5.9 or later and is heavily inspired by the Silex web micro-framework by Fabien Potencier.

Installation

git clone this repository.Download composer: curl -s https://getcomposer.org/installer | phpInstall Cilex' dependencies: php composer.phar install

Usage

Create your new commands in src/Cilex/Command/Add your new commands to bin/run.phpRun the commands as:

./bin/run.php demo:greet world./bin/run.php demo:greet world -y./bin/run.php demo:greet world --yell./bin/run.php demo:info

Creating a PHAR

Download and install box:

curl -LSs https://box-project.github.io/box2/installer.php | phpchmod +x box.pharmv box.phar /usr/local/bin/box

Update the project phar config in box.jsonCreate the package:

box build

Run the commands:

./cilex.phar demo:greet world./cilex.phar demo:greet world -y./cilex.phar demo:greet world --yell./cilex.phar demo:info

enjoy a lot.

License

Cilex is licensed under the MIT license.

FAQ

Q: How do I pass configuration into the application?

A: You can do this by adding the following line, where $configPath is the path to the configuration file you want to use:

$app->register(new \Cilex\Provider\ConfigServiceProvider(), array('config.path' => $configPath));

The formats currently supported are: YAML, XML and JSON

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:小程序生态是什么?为什么数字钱包需要引入小程序生态?
下一篇:从连接到生态,凡泰极客 FinClip2.0 开启企业端小程序应用新时代
相关文章

 发表评论

暂时没有评论,来抢沙发吧~