eureka/kernel-http

Kernel Http 用于内容 PHP 应用程序。使用 PSR-7、15 & 17 构建应用程序。

6.0.0 2024-02-22 17:05 UTC

README

Current version Supported PHP version Build Quality Gate Status Coverage

Kernel Http 用于任何 Eureka 框架应用程序。

定义全局应用程序、控制器和组件内核版本

安装

如果您想在项目中安装它,请通过 composer 引入

composer require eureka/kernel-http

用法

<?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);
}

贡献

查看CONTRIBUTING 文件。

安装/更新项目

您可以使用以下命令安装项目

make install

并使用以下命令更新

make update

注意:对于组件,composer.lock 文件没有提交。

测试 & CI(持续集成)

测试

您可以使用以下命令在您的侧运行单元测试(带有覆盖率)

make tests

您可以使用以下命令在您的侧运行功能测试(不带覆盖率)

make integration

对于更清晰的输出(但没有覆盖率),您可以使用以下命令

make testdox # run tests without coverage reports but with prettified output

代码风格

您还可以使用以下命令运行代码风格检查

make phpcs

您还可以使用以下命令运行代码风格修复

make phpcsf

静态分析

要执行代码的静态分析(使用 phpstan,默认为 lvl 9),您可以使用以下命令

make analyze

为了确保您的代码仍然与 Deezer 当前支持的版本和未来的 PHP 版本兼容,您需要运行以下命令(两者都是完全支持的必要条件)

最低支持版本

make php74compatibility

最高支持版本

make php83compatibility

CI 模拟

最后,“辅助”命令,您可以在提交和推送之前运行

make ci  

许可证

本项目目前采用 MIT 许可证(MIT)。有关更多信息,请参阅 LICENCE 文件。