基于Laravel的命令行应用程序框架。

v5.0.12 2015-07-16 09:46 UTC

This package is auto-updated.

Last update: 2024-09-06 23:16:56 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

基于 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许可证。