An open API service indexing awesome lists of open source software.

https://github.com/domainflow/core

Lightweight PHP application core with service providers, boot phases, middleware, and event dispatching.
https://github.com/domainflow/core

bootstrap container dependencyinjection di domainflow kernel modular php provider

Last synced: 4 months ago
JSON representation

Lightweight PHP application core with service providers, boot phases, middleware, and event dispatching.

Awesome Lists containing this project

README

          

# DomainFlow Core

[![Tests](https://github.com/domainflow/core/actions/workflows/tests.yml/badge.svg)](https://github.com/domainflow/core/actions/workflows/tests.yml)
![Packagist Version](https://img.shields.io/packagist/v/domainflow/core)
![PHP Version](https://img.shields.io/packagist/php-v/domainflow/core)
![License](https://img.shields.io/github/license/domainflow/core)
![PHPStan](https://img.shields.io/badge/PHPStan-Level%209-brightgreen.svg)

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](https://www.github.com/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:

```sh
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
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](https://www.domainflow.dev/docs/core).

---

## ๐Ÿ›ก License

**DomainFlow Core** is open-sourced software licensed under the [MIT license](https://opensource.org/license/MIT).