PHP code example of adrianfalleiro / slim-cli-runner
1. Go to this page and download the library: Download adrianfalleiro/slim-cli-runner 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/ */
use Psr\Http\Message\ResponseInterface as Response;
use adrianfalleiro\SlimCliRunner\CliAction;
use Psr\Log\LoggerInterface;
class ExampleCliAction extends CliAction
{
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
protected function action(): Response
{
$arg0 = $this->resolveArg(0);
$this->logToConsole("arg 0 is {$arg0}");
return $this->respond();
}
}