koikimakimoto / luster
基于Laravel的命令行应用程序框架。
v5.0.12
2015-07-16 09:46 UTC
Requires
- php: >=5.4.0
- illuminate/config: 5.0.*
- illuminate/console: 5.0.*
- illuminate/container: 5.0.*
- illuminate/contracts: 5.0.*
- illuminate/database: 5.0.*
- illuminate/events: 5.0.*
- illuminate/filesystem: 5.0.*
- illuminate/http: 5.0.*
- illuminate/support: 5.0.*
- illuminate/view: 5.0.*
- phpseclib/phpseclib: 0.3.*
- symfony/process: 2.6.*
- vlucas/phpdotenv: ~1.0
Requires (Dev)
- fabpot/php-cs-fixer: @stable
- phpunit/phpunit: 4.*
README
基于 Laravel 的命令行应用程序框架。
注意:Luster 5.0.x基于Laravel5.0。
要求
- PHP5.4或更高版本
安装
创建composer.json以通过composer安装。
{
"require": {
"kohkimakimoto/luster": "5.0.*"
}
}
运行composer install命令。
composer install
用法
入门指南
运行luster init以创建您的命令行应用程序项目文件。
php vendor/bin/luster init
Input your cli app name (default: luster)
输入您的应用程序名称。您将获得一些目录和文件。查看bin/[yourappname]。这是一个可执行命令文件,用于启动应用程序。
运行此命令。
php bin/yourappname
您是否收到如下消息?这是正常的。Luster已正确安装。
yourappname version 0.1.0
Usage:
command [options] [arguments]
Options:
--help (-h) Display this help message
--quiet (-q) Do not output any message
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version (-V) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
...
让我们开始开发您的命令行应用程序。通过您的文本编辑器打开bin/yourappname文件。
#!/usr/bin/env php <?php require_once __DIR__ . '/../vendor/autoload.php'; use Kohkimakimoto\Luster\Foundation\Application; $app = new Application("yourappname", "0.1.0"); $app->setBasePath(realpath(__DIR__."/..")); $app->register([ // 'Illuminate\Database\DatabaseServiceProvider', // 'Illuminate\Database\MigrationServiceProvider', // 'Illuminate\Database\SeedServiceProvider', // 'Kohkimakimoto\Luster\Process\ProcessServiceProvider', ]); $app->setAliases([ // 'Process' => 'Kohkimakimoto\Luster\Process\Facades\Process', ]); $app->command([ // 'Kohkimakimoto\Luster\Commands\HelloCommand', ]); $app->run();
取消注释$app->command([...])方法内部的行。
$app->command([ 'Kohkimakimoto\Luster\Commands\HelloCommand', ]);
待续...
作者
Kohki Makimoto kohki.makimoto@gmail.com
许可证
MIT许可证。