2017 © Pedro Peláez
 

library container

Rudra framework

image

rudra/container

Rudra framework

  • Tuesday, June 5, 2018
  • by jagepard
  • Repository
  • 1 Watchers
  • 1 Stars
  • 838 Installations
  • PHP
  • 12 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

Build Status Scrutinizer Code Quality Code Climate, (*1)

CodeFactor

Code Intelligence Status Latest Stable Version Total Downloads GitHub, (*2)

Rudra-Container | API

Installation | Установка

composer require rudra/container, (*3)

Using | Использование

use Rudra\Container\Rudra;

Rudra::run();

using Facade | используя фасад:, (*4)

use Rudra\Container\Facades\Rudra;

Setting | Настройка:

Bind an interface to an implementation or pre-arranged factory
Связать интерфейс с реализацией или заранее подготовленной фабрикой:, (*5)


Rudra::run()->binding([
    SomeInterface::class => SomeClass::class
    ...
    SomeInterface::class => SomeFactory::class
    ...
    SomeInterface::class => 'service-name'
    ...
    SomeInterface::class => function (){
        return new SomeClass();
    }
    ...
    SomeInterface::class => function (){
        return (new SomeFactory)->create();
    }    
]);

using Facade | используя фасад:, (*6)

Rudra::binding([
    SomeInterface::class => SomeClass::class
    ...
    SomeInterface::class => SomeFactory::class
    ...
    SomeInterface::class => 'service-name'
        ...
    SomeInterface::class => function (){
        return new SomeClass();
    }
    ...
    SomeInterface::class => function (){
        return (new SomeFactory)->create();
    }
]);

Installs services into a waiting container to be initialized when called:
Устанавливает сервисы в контейнер ожидающих, для инициализации при вызове:, (*7)


Rudra::run()->waiting([
    'service-name' => [SomeClass::class, ['param-1', 'param-2']]
    ...
    'service-name' => SomeFactory::class
    ...
    'service-name' => function (){
        return new SomeClass();
    }
    ...
     'service-name' => function (){
        return (new SomeFactory)->create();
    }
}
])

using Facade | используя фасад:, (*8)

Rudra::waiting([
    'service-name' => [SomeClass::class, ['param-1', 'param-2']]
    ...
    'service-name' => SomeFactory::class
    ...
    'service-name' => function (){
        return new SomeClass();
    }
    ...
     'service-name' => function (){
        return (new SomeFactory)->create();
    }
}
])

Add a bind to previously established ones:
Добавляем привязку к ранее установленным:, (*9)


Rudra::run()->binding()->set([SomeInterface::class => SomeClass::class])

using Facade | используя фасад:, (*10)

Rudra::binding()->set([SomeClass::class, ['param-1', 'param-2']);

Add the service to the previously installed ones:
Добавляем сервис к ранее установленным:, (*11)


Rudra::run()->waiting()->set([
    'service-name' => [SomeClass::class, ['param-1', 'param-2']]
    ...
    'service-name' => SomeFactory::class
])

using Facade | используя фасад:, (*12)

Rudra::waiting()->set([
    'service-name' => [SomeClass::class, ['param-1', 'param-2']]
    ...
    'service-name' => SomeFactory::class
])

Call the created service:
Вызываем созданный сервис:, (*13)


Rudra::run()->get('service-name')

using Facade | используя фасад:, (*14)

Rudra::get('service-name')

If the service does not have parameters, or the parameters are in the binding, then the service will be created automatically when calling
Если сервис не имеет параметров, либо параметры имеются в привязке, то сервис будет создан автоматически при вызове, (*15)


Rudra::run()->get(Service::class)

using Facade | используя фасад:, (*16)

Rudra::get(Service::class)

The Versions

05/06 2018

dev-master

9999999-dev

Rudra framework

  Sources   Download

MIT GPL-3.0-or-later

The Requires

  • php >=7.1

 

The Development Requires

container dependency-injection rudra dependency-injection-container ioc-container

05/06 2018

v2.0.0

2.0.0.0

Rudra framework

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.1

 

The Development Requires

container dependency-injection rudra dependency-injection-container ioc-container

01/06 2018

dev-import

dev-import

Rudra framework

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.1

 

The Development Requires

container dependency-injection rudra dependency-injection-container ioc-container

24/04 2017

1.2.0

1.2.0.0

The Rudra framework

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

container dependency-injection rudra dependency-injection-container ioc-container

11/04 2017

1.1.0

1.1.0.0

The Rudra framework

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

container rudra

06/04 2017

1.0.1

1.0.1.0

The Rudra framework

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

container rudra

03/04 2017

1.0.0

1.0.0.0

The Rudra framework

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

container rudra