PHP code example of comphp / runtime

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

    

comphp / runtime example snippets




declare(strict_types=1);

namespace App;

use CommonPHP\Runtime\Contracts\ExecutiveInterface;
use CommonPHP\Runtime\Support\ExitStatus;
use CommonPHP\Runtime\Kernel;

final class AppKernel extends Kernel
{
}

final class ConsoleExecutive implements ExecutiveInterface
{
    public function execute(): int
    {
        echo "Hello from CommonPHP Runtime\n";

        return ExitStatus::SUCCESS;
    }
}

$kernel = new AppKernel();
$kernel
    ->setRoot(dirname(__DIR__))
    ->setEnvironment('dev')
    ->setDebugging(true)
    ->setExecutive(ConsoleExecutive::class);

exit($kernel->execute());
bash
vendor/bin/phpunit -c phpunit.xml.dist
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff