eureka/kernel-console

Kernel for Eureka Framework. Define console application kernel versions


License
MIT

Documentation

kernel-http

Current version Supported PHP version Build Quality Gate Status Coverage

Kernel Console for any Eureka Framework application.

Define global Application & Component kernel version

Installation

You can install the kernel (for testing) with the following command:

make install

Update

You can update the kernel (for testing) with the following command:

make update

Usage

<?php

/*
 * Copyright (c) Romain Cottard
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Eureka\Kernel\Console\Application\Application;
use Eureka\Kernel\Console\Kernel;
use Psr\Container\NotFoundExceptionInterface;

//~ Define Loader & add main classes for config
require_once __DIR__ . '/vendor/autoload.php';

try {

    $root   = realpath(__DIR__ . '/..');
    $env    = 'dev';
    $debug  = true;

    $kernel = new Kernel($root, $env, $debug);

    $console = (new Application($argv, $kernel->getContainer()))
        ->setBaseNamespaces([
            'Application\Script',
            'Eureka\Component\Deployer\Script',
            'Eureka\Component',
        ])
        //->setLogger()
    ;

    $console->before();
    $console->run();
    $console->after();
    $console->terminate();

} catch (NotFoundExceptionInterface $exception) {
    echo 'Exception: ' . $exception->getMessage() . PHP_EOL;
    exit(1);
} catch (\Exception $exception) {
    echo 'Exception: ' . $exception->getMessage() . PHP_EOL;
    exit(1);
}

Testing

You can test the kernel with the following commands:

make phpcs
make tests
make testdox