PHP code example of netglue / laminas-symfony-console

1. Go to this page and download the library: Download netglue/laminas-symfony-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/ */

    

netglue / laminas-symfony-console example snippets


#!/usr/bin/env/php

declare(strict_types=1);

use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application;

$container = 

return [
    'console' => [
        'name' => 'My CLI Application',
        'auto_add_invokable_factory' => true,
        'commands' => [
            'my:command' => \My\Console\DoAThing::class,
            'my:other-cmd' => \My\Console\OtherThing::class,
        ],
    ],
    'dependencies' => [
        'factories' => [
            \My\Console\DoAThing::class => \My\Console\DoAThingFactory::class,
        ],
    ],
    // Also, prefer listing commands here instead of under console.commands for future interop with laminas-cli
    'laminas-cli' => [
        'commands' => [
            'my::command' => \Some\Command::class,
        ],
    ],
];