Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Cilex/Cilex
Cilex a lightweight framework for creating PHP CLI scripts inspired by Silex
https://github.com/Cilex/Cilex
Last synced: about 1 month ago
JSON representation
Cilex a lightweight framework for creating PHP CLI scripts inspired by Silex
- Host: GitHub
- URL: https://github.com/Cilex/Cilex
- Owner: Cilex
- License: mit
- Created: 2011-10-19T22:21:18.000Z (about 13 years ago)
- Default Branch: develop
- Last Pushed: 2023-12-14T21:38:12.000Z (12 months ago)
- Last Synced: 2024-10-19T10:39:39.478Z (about 2 months ago)
- Language: PHP
- Homepage: http://cilex.github.io
- Size: 102 KB
- Stars: 620
- Watchers: 29
- Forks: 68
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php - Cilex - A micro framework for building command line tools. (Table of Contents / Command Line)
- awesome-php-cn - Cilex - 一个微型的框架来构建命令行工具. (目录 / 命令行 Command Line)
- awesome-projects - Cilex - A micro framework for building command line tools. (PHP / Command Line)
- awesome-php - Cilex - A micro framework for building command line tools. (Table of Contents / Command Line)
README
Cilex, a simple Command Line Interface framework
================================================Cilex is a simple command line application framework to develop simple tools
based on [Symfony2][1] components:```php
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][2]
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:
```sh
./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][5]:
```sh
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:
```sh
box build
```
- Run the commands:
```sh
./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.
[1]: http://symfony.com
[2]: http://silex.sensiolabs.org
[3]: http://cilex.github.com/get/cilex.phar
[4]: http://cilex.github.com/documentation
[5]: https://box-project.github.io/box2/## 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:
```php
$app->register(new \Cilex\Provider\ConfigServiceProvider(), array('config.path' => $configPath));
```The formats currently supported are: YAML, XML and JSON