domainflow/core
最新稳定版本:v0.1.0
Composer 安装命令:
composer require domainflow/core
包简介
A lightweight PHP application bootstrapper with service providers, boot phases, middleware, and config management.
关键字:
README 文档
README
The DomainFlow Core package is a Lightweight Application Bootstrapper with features like Service Providers, Application Bootstrapping, Middleware, Event Management, and Configuration Management to help structure and maintain PHP back-end applications and microservices.
✨ Core Functionality
-
Application Container
Inherits all DI capabilities from DomainFlow Container, including class auto-wiring, singleton bindings, and contextual bindings. -
Service Providers
Register and configure your services, including deferred loading for improved performance (load services only when first requested). -
Bootstrapping & Lifecycle Management
Built-in support for structured boot phases and graceful termination. -
Event Management
A basic but extendable event dispatcher to publish and subscribe to application events. -
Configuration & Environment Management
Manage environment variables, base paths, and config paths out of the box. -
Caching
Optionally cache resolved service instances (and deferred providers) for faster subsequent loads.
📦 Installation
Install DomainFlow Core with Composer:
composer require domainflow/core
🧪 Example Usage
Below is a minimal example demonstrating how to set up an application, register a service provider, and retrieve a service:
<?php use DomainFlow\Application; use DomainFlow\Service\AbstractServiceProvider; // 1. Define your own service provider. class MyServiceProvider extends AbstractServiceProvider { protected array $providedServices = [MyService::class]; public bool $defer = true; // Lazy loading, only load on first use public function register(Application $app): void { // Bind a service... $app->bind(MyService::class, fn() => new MyService(), true); } } // 2. Create a new application. $app = new Application(); // 3. Register your provider. $app->registerProvider(new MyServiceProvider()); // 4. Boot the application (register event listeners, run boot callbacks, etc.). $app->boot(); // 5. Get your service. $service = $app->get(MyService::class); $service->doSomething();
More details and usage examples can be found in our DomainFlow Core documentation.
🛡 License
DomainFlow Core is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-08