PHP code example of simsoft / console

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

    

simsoft / console example snippets


#!/usr/bin/env php

declare(strict_types=1);
Console\Application;

$status = Application::make('My App', '1.0')
    ->withCommands([
        HelloWorldCommand::class,
    ])
    ->run();

exit($status);


declare(strict_types=1);

namespace App\Commands;

use Simsoft\Console\Command;

class HelloWorldCommand extends Command
{
    public static string $name = 'screen:welcome';
    public static string $description = 'Display a welcome message';

    protected function handle(): void
    {
        $this->info('Hello World');
    }
}
shell
docker run --rm -v "$PWD":/app -w /app php:8.4-cli sh -c \
  'pecl install pcov && docker-php-ext-enable pcov &&
   vendor/bin/phpunit --coverage-clover coverage.xml --coverage-text --only-summary-for-coverage-text &&
   php tools/coverage-threshold.php coverage.xml 94'