PHPackages                             purpleharmonie/dependency-injection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. purpleharmonie/dependency-injection

ActiveLibrary[Framework](/categories/framework)

purpleharmonie/dependency-injection
===================================

Purple Container is a lightweight dependency injection container for managing class dependencies and performing dependency injection in PHP applications.

2.0.0(1y ago)214MITPHP

Since Jun 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ohenekofi/Purple-Dependency-Injection-Component)[ Packagist](https://packagist.org/packages/purpleharmonie/dependency-injection)[ RSS](/packages/purpleharmonie-dependency-injection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Purple Framework Documentation
==============================

[](#purple-framework-documentation)

Table of Contents
-----------------

[](#table-of-contents)

1. [Introduction](#introduction)
2. [Core Components](#core-components)
3. [Dependency Injection Container](#dependency-injection-container)
4. [Kernel](#kernel)
5. [Service Management](#service-management)
6. [Event System](#event-system)
7. [Kernel Extensions](#kernel-extensions)
8. [Configuration Management](#configuration-management)
9. [Caching](#caching)
10. [Service Discovery](#service-discovery)
11. [Compiler Passes](#compiler-passes)
12. [Error Handling](#error-handling)

Introduction
------------

[](#introduction)

Purple is a comprehensive PHP framework designed to provide a robust foundation for building scalable and maintainable applications. It features a powerful dependency injection container, modular architecture, and various tools to enhance development productivity. Inspired by popular frameworks like Symfony but with its own unique features. It provides a flexible and extensible way to manage dependencies and services in PHP applications. NOTE STILL UNDER DEVELOPMENT BUT CAN BE USED IN APPLLICATIONS.

Installation
------------

[](#installation)

You can install PHP Container via Composer. Run the following command in your terminal:

```
composer require purpleharmonie/dependency-injection

```

Core Components
---------------

[](#core-components)

### Dependency Injection Container

[](#dependency-injection-container)

The heart of the Purple framework, managing service instantiation and dependencies.

Features:

- Service registration and retrieval
- Autowiring
- Lazy loading
- Scoped services (asGlobal, asShared)
- Aliasing
- Tagging
- Service decoration
- Middleware

### Kernel

[](#kernel)

Manages the application's lifecycle and bootstraps the framework.

Features:

- Environment management
- Debug mode
- Bundle registration and booting in using bundle registration, your set the $configDir path. the bunlde classes whould be organised in an array and with each class extending the bundle interface. Find an example bundles in the examples folder this is to cretae the bundle registry in the $config path. It loaded into services during kernel boot ```
