PHPackages                             lotos/container - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lotos/container

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lotos/container
===============

2.0.0(4y ago)0123GPL-3.0PHPPHP ^8.0

Since Mar 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/LotosFramework/container)[ Packagist](https://packagist.org/packages/lotos/container)[ RSS](/packages/lotos-container/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Container
=========

[](#container)

Установка
---------

[](#установка)

```
composer require lotos/container
```

Установка зависимостей
----------------------

[](#установка-зависимостей)

```
$collection = CollectionFactory::createCollection();
$repository = RepositoryFactory::createRepository($collection->newInstance());

$container = ContainerFactory::createContainer(
    repository: $repository,
    builder: BuilderFactory::createBuilder(
        repository: $repository,
        collection: $collection
    )
);

$container->saveClass(Lotos\Http\ServerRequestFactory::class)
    ->forInterface(Psr\Http\Message\ServerRequestFactoryInterface::class)
    ->withAlias('serverRequestFactory');

$container->saveClass(Lotos\Http\Strategies\JsonStrategy::class)
    ->forInterface(Lotos\Http\StrategyInterface::class)
    ->withPriority(1)
    ->withAlias('jsonStrategy');

$container->saveClass(Lotos\Http\Strategies\HtmlStrategy::class)
    ->forInterface(Lotos\Http\StrategyInterface::class)
    ->withAlias('htmlStrategy');
```

Получение объекта из контейнера
-------------------------------

[](#получение-объекта-из-контейнера)

```
$router = $container->get('router');
```

Получение результата работы метода объекта, хранящегося в контейнере
--------------------------------------------------------------------

[](#получение-результата-работы-метода-объекта-хранящегося-в-контейнере)

```
$container->saveClass(Lotos\Http\ServerRequest\ServerRequest::class)
    ->forInterface(Psr\Http\Message\ServerRequestInterface::class)
    ->setInstance(
        $container->call('serverRequestFactory', 'fromGlobals')
    );
```

Инъекции зависимостей
---------------------

[](#инъекции-зависимостей)

### ВНИМАНИЕ!

[](#внимание)

**В текущей версии была удалена возможность устанавливать инъекции в свойства объектов, например:**

```
class Example
{
    /**
     * @var Psr\Http\Message\RequestInterface
     * */
    private RequestInterface $request;
}
```

**теперь работать не будет и нужно явно указать в какой медот нужно внедрить инъекцию:**

```
use Psr\Http\Message\{
    RequestInterface,
    ResponseInterface,
    ResponseFactoryInterface
};

class User
{
    public function __construct(
        private ResponseFactoryInterface $responseFactory
    )
    {}

    public function create(RequestInterface $request) : ResponseInterface
    {
        //...
    }

}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1531d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc7eff50a38e6266618583785549de12334d2601fd930678e0bae685960a134b?d=identicon)[McLotos](/maintainers/McLotos)

---

Top Contributors

[![McLotos](https://avatars.githubusercontent.com/u/8168531?v=4)](https://github.com/McLotos "McLotos (29 commits)")[![phpteach](https://avatars.githubusercontent.com/u/74470056?v=4)](https://github.com/phpteach "phpteach (17 commits)")

### Embed Badge

![Health badge](/badges/lotos-container/health.svg)

```
[![Health](https://phpackages.com/badges/lotos-container/health.svg)](https://phpackages.com/packages/lotos-container)
```

###  Alternatives

[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31278.1M2.0k](/packages/illuminate-container)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/object-mapper

Provides a way to map an object to another object

34885.7k18](/packages/symfony-object-mapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
