PHP code example of elfsundae / console

1. Go to this page and download the library: Download elfsundae/console library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elfsundae / console example snippets


#!/usr/bin/env php


sole\Application;

// ... register commands

$app->run();

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');

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

(new ElfSundae\Console\Application)
    ->add(new Example)
    ->getApplication()
    ->runAsSingle();