承接 hydrakit/kernel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hydrakit/kernel

Composer 安装命令:

composer require hydrakit/kernel

包简介

Default composition root and HTTP plumbing for the Hydra PHP framework

README 文档

README

The framework's default composition root and HTTP plumbing. It exists to keep the wiring that is identical across every Hydra app in one place, so a consumer's AppServiceProvider holds only policy — not the boilerplate that used to be copied into each app and drift.

What it ships

  • Kernel::application($container, $basePath) — builds the shared composition root: binds the container and Environment, then registers the standard provider stack in the correct order (SessionEventAuthAuthorization). Returns the Application so the app chains its own providers. Adding a framework package to the stack is now a one-line edit here that every consumer picks up on composer update.
  • HttpServiceProvider — binds the invariant HTTP plumbing: the PSR-17 factories, the request provider, the emitter, the responder, the route cache, the router, the middleware pipeline, and the HTTP kernel. It takes the app's policy — the controller list, the middleware stack, the route-cache toggle and path — as plain constructor data, so it never needs to know an app's config types.

Using it

A consumer's bootstrap collapses to composing these with its own provider:

public static function application(string $basePath): Application
{
    $container = new Container(new \DI\Container);
    $routeCache = RouteConfig::fromEnvironment(new Environment($basePath))->cache;

    return Kernel::application($container, $basePath)
        ->register(new HttpServiceProvider(
            controllers: AppServiceProvider::CONTROLLERS,
            middleware:  AppServiceProvider::MIDDLEWARE,
            routeCacheEnabled: $routeCache,
            routeCachePath: $basePath . '/bootstrap/cache/routes.php',
        ))
        ->register(new AppServiceProvider);
}

The app's AppServiceProvider then binds only what is genuinely its own: config value objects, the data layer, the user provider, the view, the logger, the two config-needing middleware (ForceHttps, ErrorHandler), and its event listeners.

The DI engine stays the app's choice

Kernel::application() takes an already-built ContainerInterface rather than constructing one, so the app keeps ownership of its php-di (or other) container. The kernel wires providers into it; it does not pick it.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固