hydrakit/core
Composer 安装命令:
composer require hydrakit/core
包简介
Core library for Hydra PHP framework
README 文档
README
The framework-agnostic foundation: the application object, the contracts every other package depends on, environment loading, and a base service provider. Core defines interfaces and orchestration — it ships no concrete container, kernel, or HTTP layer. Those are bound by the application at runtime.
Contracts
The public API every other package codes against.
KernelInterface—handle()runs the request lifecycle and emits the response (returns nothing);terminate()performs post-response clean-up.ServiceProviderInterface—register()binds services into the container;boot()runs once all providers are registered.ContainerInterface— extends PSR-11'sContainerInterfaceand addssingleton()(autowires a class-string or uses a callable factory; every entry is shared — there is no transient binding yet),instance()(register an already-constructed object), andbound()(does a binding exist). Core declares this interface only; the concrete container is supplied by the app.
Environment
Environment reads <basePath>/.env and exposes typed accessors: get(),
has(), string(), int(), and bool(). A missing .env is tolerated;
a present-but-non-integer value passed to int() throws rather than silently
coercing to 0.
Providers
Providers\ServiceProvider is a concrete base class with empty register()
and boot() methods. App and package providers extend it and override what
they need; bindings are registered here.
Application
Application accepts a ContainerInterface and owns the boot sequence:
register(ServiceProviderInterface)— registers a provider (and boots it immediately if the app has already booted).boot()— boots every registered provider exactly once.run()— boots, resolves theKernelInterfacefrom the container, callshandle(), flushes the response withfastcgi_finish_request()when available, then callsterminate().
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-07