climphp / clim
Clim is a PHP micro framework that helps you quickly write simple yet powerful command line applications
v1.5.0
2017-04-26 05:10 UTC
Requires
- php: >=5.6.0
- psr/container: ^1.0
- slim/slim: ^3.8
Requires (Dev)
- codeception/codeception: ^2.2
- symfony/debug: ^3.2
- symfony/var-dumper: ^3.2
README
PHP Micro framework for command line application inspired by Slim Framework
Features
- Simple yet powerful configuration
- DI Container support
- Sub command dispatch
- Middleware support
Install
$ composer require climphp/clim
Usage
After composer install
, create an hello.php
file with the following contents:
<?php require 'vendor/autoload.php'; $app = new Clim\App(); $app->opt('-u|--upper'); $app->arg('name')->default('unknown'); $app->task(function ($opts, $args) { $name = $args['name']; if ($opts['u']) $name = strtoupper($name); echo "Welcome, {$name}\n"; }); $app->run();
Then from the shell:
$ php hello.php Nocchi Welcome, Nocchi $ php hello.php -u Kashiyuka Welcome, KASHIYUKA
For more information on how to configure your clie application, see the Documentation.
Tests
To execute the test suite, you'll need codeception.
$ vendor/bin/codecept run unit
Credits
Special thanks to Slim Framework for the archtecture and the api design.
License
The Clim Framework is licensed under the MIT license. See License File for more information.