PHP code example of eureka / kernel-http

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

    

eureka / kernel-http example snippets




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
$response);
} catch (\Exception $exception) {
    echo 'Exception: ' . $exception->getMessage() . PHP_EOL;
    echo 'Trace: ' . $exception->getTraceAsString() . PHP_EOL;
    exit(1);
}




declare(strict_types=1);

namespace Eureka\Kernel\Http\Tests\Unit\Mock;

use Eureka\Kernel\Http\Controller\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

class ExampleController extends Controller
{
    public function home(): ResponseInterface
    {
        return $this->getResponse('Hello world!');
    }
    
    public function viewWithParams(
        ServerRequestInterface $serverRequest,
        string $someString,
        bool $someBool,
        int $someInt,
        string $id,
        string $title,
    ): ResponseInterface {
        return $this->getResponse("entity id: $id, title: $title, someString: $someString, someBool: " . ($someBool ? 'true' : 'false') . ", someInt: $someInt");
    }

yaml
parameters:

  #~ Debug
  kernel.debug: false

  #~ Environment
  kernel.environment: 'prod' # Overridden in Kernel class, but define here as helper

  #~ Errors
  kernel.error.display:   'false'
  kernel.error.reporting: !php/const E_ALL

  #~ Directories
  kernel.directory.root:   '..' # Overridden in Kernel class, but define here as helper
  kernel.directory.cache:  '%kernel.directory.root%/var/cache'
  kernel.directory.log:    '%kernel.directory.root%/var/log'
  kernel.directory.config: '%kernel.directory.root%/config'
  kernel.directory.vendor: '%kernel.directory.root%/vendor'

  #~ Compiler passes
  kernel.compiler_pass:
    - My\Custom\CompilerPass
bash
make php/tests
bash
make php/integration
bash
make php/check
bash
make php/fix
bash
make php/deps
bash
make php/analyse
bash
make php/min-compatibility
bash
make php/max-compatibility