Skip to content

Commit

Permalink
chore: update readme for container package
Browse files Browse the repository at this point in the history
  • Loading branch information
bautrukevich committed May 10, 2024
1 parent 7b937ac commit 33b8cf5
Showing 1 changed file with 3 additions and 46 deletions.
49 changes: 3 additions & 46 deletions packages/container/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<p align="center">
<a href="https://github.com/A50dev" target="_blank">
<img src="https://avatars0.githubusercontent.com/u/86768962" height="240px">
<img src="https://avatars.githubusercontent.com/u/150102356" height="240px">
</a>
<h1 align="center">A50 Container</h1>
<br>
</p>

This package provides a factory for [PSR-11](http://www.php-fig.org/psr/psr-11/) compatible
[dependency injection](http://en.wikipedia.org/wiki/Dependency_injection) container that is able to instantiate
and configure classes resolving dependencies and `ServiceProvider` interface.

Uses [PHP-DI](https://php-di.org/) as a core.
This package provides a Service Provider interface.

[![Latest Version on Packagist](https://img.shields.io/packagist/v/a50/container.svg?style=flat-square)](https://packagist.org/packages/a50/container)
[![Tests](https://github.com/a50/container/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/a50/container/actions/workflows/run-tests.yml)
Expand All @@ -26,46 +22,7 @@ composer require a50/container

## Usage

To create a container you need to pass array of `ServiceProvider` objects interface:

```php
<?php

declare(strict_types=1);

use Psr\Container\ContainerInterface;
use A50\Container\ContainerFactory;
use A50\Container\ServiceProvider;

$container = ContainerFactory::build([
new class implements ServiceProvider {
/**
* @inheritDoc
*/
public static function getDefinitions(): array
{
return [
stdClass::class => static fn() => new stdClass(),
];
}

/**
* @inheritDoc
*/
public static function getExtensions(): array
{
return [
stdClass::class => static function ($stdClass, ContainerInterface $container): stdClass {
$stdClass->property = 'value';

return $stdClass;
}
];
}
}
]);

```
TBD

## Testing

Expand Down

0 comments on commit 33b8cf5

Please sign in to comment.