> For the complete documentation index, see [llms.txt](https://docs.sonsofphp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonsofphp.com/components/registry.md).

# Registry

### Installation

```shell
composer require sonsofphp/registry
```

### Usage

```php
<?php

use SonsOfPHP\Component\Registry\ServiceRegistry;

$registry = new ServiceRegistry($interfaceClassName);

$registry->register('service.id', $service);
$service = $registry->get('service.id');

if ($registry->has('service.id')) {
    // ...
}

$registry->unregister('service.id');

foreach ($registry->all() as $identifier => $service) {
    // ...
}
```
