eureka/kernel-http

Kernel Http for Content PHP application. Use PSR-7, 15 & 17 to build an application.

5.1.0 2020-11-13 16:11 UTC

This package is auto-updated.

Last update: 2022-01-13 18:53:43 UTC


README

Current version Supported PHP version Build Quality Gate Status Coverage

Kernel Http for any Eureka Framework application.

Define global Application, Controller & Component kernel versions

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

declare(strict_types=1);

/*
 * 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\Http\Application\Application;
use Eureka\Kernel\Http\Kernel;

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

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

// Run application
// Applications exception should be caught. Try catch useful only when you have a bug in kernel component
try {
    $application = new Application(new Kernel($root, $env, $debug));
    $response    = $application->run();
    $application->send($response);
} catch (\Exception $exception) {
    echo 'Exception: ' . $exception->getMessage() . PHP_EOL;
    echo 'Trace: ' . $exception->getTraceAsString() . PHP_EOL;
    exit(1);
}

Testing

You can test the kernel with the following commands:

make tests
make testdox