2017 © Pedro Peláez
 

library console

CLI library based on Laravel Console for creating PHP console application.

image

elfsundae/console

CLI library based on Laravel Console for creating PHP console application.

  • Wednesday, September 20, 2017
  • by ElfSundae
  • Repository
  • 2 Watchers
  • 6 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads, (*1)

CLI library based on Laravel Console for creating PHP console application., (*2)

Installation

$ composer require elfsundae/console

Usage

First, create a PHP script and make it executable:, (*3)

#!/usr/bin/env php
<?php

require __DIR__.'/vendor/autoload.php';

$app = new ElfSundae\Console\Application;

// ... register commands

$app->run();

Then, you can register commands using add or command method., (*4)

The add method accepts an Illuminate\Console\Command instance or a Symfony\Component\Console\Command\Command instance. The command method may be used for register a Closure based command, it accepts three arguments: the command signature, a Closure which receives the commands arguments and options, and the optional description of the command., (*5)

class Example extends Illuminate\Console\Command
{
    protected $signature = 'example
        {--foo=bar : The "foo" option description}';

    protected $description = 'Example command description';

    public function handle()
    {
        $this->comment($this->option('foo'));
    }
}

$app->add(new Example);

$app->command('title {username}', function ($username) {
    $this->comment(title_case($username));
}, 'The `title` command description');

To build a single command application, you may pass true to the second argument of the setDefaultCommand method, or just call the runAsSingle method:, (*6)

(new ElfSundae\Console\Application)
    ->add($command = new Example)
    ->getApplication()
    ->setDefaultCommand($command->getName(), true)
    ->run();
(new ElfSundae\Console\Application)
    ->add(new Example)
    ->getApplication()
    ->runAsSingle();

Documentation

Testing

$ composer test

License

This package is open-sourced software licensed under the MIT License., (*7)

The Versions

20/09 2017

dev-master

9999999-dev https://github.com/ElfSundae/console

CLI library based on Laravel Console for creating PHP console application.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel command console cli artisan script

20/09 2017

1.0.2

1.0.2.0 https://github.com/ElfSundae/console

CLI library based on Laravel Console for creating PHP console application.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel command console cli artisan script

19/08 2017

1.0.1

1.0.1.0 https://github.com/ElfSundae/console

CLI library based on Laravel Artisan for creating PHP console scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel command console cli artisan script

18/08 2017

1.0.0

1.0.0.0 https://github.com/ElfSundae/console

CLI library based on Laravel Artisan for creating PHP console scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel command console cli artisan script