Cilex

Cilex a lightweight framework for creating PHP CLI scripts inspired by Silex

  • 所有者: Cilex/Cilex
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Cilex, a simple Command Line Interface framework

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

<?php
if (!$loader = include __DIR__.'/vendor/autoload.php') {
    die('You must set up the project dependencies.');
}

$app = new \Cilex\Application('Cilex');
$app->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

  1. git clone this repository.
  2. Download composer: curl -s https://getcomposer.org/installer, php
  3. Install Cilex' dependencies: php composer.phar install

Usage

  • Create your new commands in src/Cilex/Command/
  • Add your new commands to bin/run.php
  • Run 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, php
chmod +x box.phar
mv box.phar /usr/local/bin/box
  • Update the project phar config in box.json
  • Create 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

主要指標

概覽
名稱與所有者Cilex/Cilex
主編程語言PHP
編程語言Puppet (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2011-10-19 22:21:18
推送於2023-12-14 21:38:12
最后一次提交2016-11-20 15:31:12
發布數5
最新版本名稱2.0.0 (發布於 )
第一版名稱0.1 (發布於 )
用户参与
星數619
關注者數28
派生數67
提交數116
已啟用問題?
問題數30
打開的問題數1
拉請求數32
打開的拉請求數4
關閉的拉請求數20
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?