PHP code example of gameplayjdk / slim-console

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

    

gameplayjdk / slim-console example snippets



// ...

$configuration = [];

$console = new \Slim\Console\Console();

if ($console->isSupported()) {
    $configuration['environment'] = $console->getEnvironment($argv);
}

$configuration['settings'] = [
    // ...
];

$app = new \Slim\App($configuration);

// ...



// ...

$app->get('/cli/some-command', \App\Controller\CliController::class . ':someCommandAction')
    ->add($console->getMiddleware());

// ...
bash
php app.php cli some-command