https://github.com/arikaim/container
Dependency Injection Container
https://github.com/arikaim/container
arikaim arikaim-cms cms container dependency-injection dependency-injection-container
Last synced: 18 days ago
JSON representation
Dependency Injection Container
- Host: GitHub
- URL: https://github.com/arikaim/container
- Owner: arikaim
- License: mit
- Created: 2017-12-11T13:09:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-09T11:52:39.000Z (over 2 years ago)
- Last Synced: 2025-09-11T02:04:32.037Z (10 months ago)
- Topics: arikaim, arikaim-cms, cms, container, dependency-injection, dependency-injection-container
- Language: PHP
- Size: 38.1 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
## Arikaim Container


Mini Dependency Injection Container
PSR-11 compatibility
#### Installation
```sh
composer require arikaim/container
```
#### Usage
```php
use Arikaim\Container\Container;
$container = new Container();
```
**Add service to container**
```php
$container['service'] = function() {
echo "Service example";
};
$container->add('service_add',function() {
echo "Service add example";
});
$container->add('date',function () {
return new \DateTime();
});
$date = $container['date'];
echo $date->format('Y-m-d');
```
**Add parameters**
```php
$container['config'] = "Config value";
```
**Replace service**
```php
$container->replace('service',function() {
echo "Replace Service";
});
```
**Psr-11** compatibility implement the PSR-11 ContainerInterface
```php
$servcie = $container->get('service');
if ($container->has('service')) {
\\ Service exists
}
```
#### License
MIT License