Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leprephp/di
A simple Dependency Injection Container, PSR-11 compliant.
https://github.com/leprephp/di
dependency-injection php php7 psr-11
Last synced: about 24 hours ago
JSON representation
A simple Dependency Injection Container, PSR-11 compliant.
- Host: GitHub
- URL: https://github.com/leprephp/di
- Owner: leprephp
- License: mit
- Created: 2017-10-31T14:14:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-06T08:00:39.000Z (over 2 years ago)
- Last Synced: 2024-11-14T09:32:37.289Z (2 months ago)
- Topics: dependency-injection, php, php7, psr-11
- Language: PHP
- Size: 31.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**🚧 This project is in early development stage and it could change significantly in the future.**
# Lepre DI
[![Test library](https://github.com/metaline/wp-api-client/actions/workflows/test-library.yml/badge.svg)](https://github.com/leprephp/di/actions)
[![Coverage Status](https://coveralls.io/repos/github/leprephp/di/badge.svg?branch=master)](https://coveralls.io/github/leprephp/di?branch=master)A simple Dependency Injection Container, [PSR-11][psr11] compliant.
## Installation
Install the latest version with [Composer][composer]:
```
$ composer require lepre/di:dev-master
```### Requirements
This project works with PHP 7.4 or above.
## Basic Usage
```php
use Lepre\DI\Container;$container = new Container();
// register a service:
$container->set('my service', function () {
return new MyService();
});// register a service with dependencies:
$container->set('other service', function (Container $container) {
return new OtherService(
$container->get('my service')
);
});
```## License
This project is licensed under the MIT License. See the LICENSE file for details.
[composer]: https://getcomposer.org/
[psr11]: http://www.php-fig.org/psr/psr-11/