2017 © Pedro PelĂĄez
 

library container

OSF dynamic object container mechanism

image

osflab/container

OSF dynamic object container mechanism

  • Saturday, April 21, 2018
  • by Guillaume Ponçon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 13 Dependents
  • 6 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

OSF Container: dynamic object management mecanism

OSF Container manages instances of your classes in order to optimize performance and accessibility. Define the instantiation policy of each class and let OSF Container create and manage your objects., (*1)

Features

  • Lazy classes instanciations
  • Optimized management of the instantiation policy
  • Dependency management
  • Mock objects generation & advanced mocking policy
  • Extremely simplified access to objects

Installation

You need at least php 7.1 and composer:, (*2)

sudo apt install composer

In your application via composer

This is the recommended way to use this feature in a non-osf project., (*3)

Just add osflab/container in your composer.json file., (*4)

From github

To test the component or participate in its development., (*5)

git clone https://github.com/osflab/container.git
cd container && composer update

Unit tests launch:, (*6)

vendor/bin/runtests

Usage

For example, to use Osf\Cache component (anyware in your code):, (*7)

$cache = \Osf\Container\OsfContainer::getCache();

To create your own container:, (*8)

use Osf\Container\AbstractContainer;

class MyContainer extends AbstractContainer
{
    /**
     * Build and get on-demand \My\Class instance(s)
     * @return \My\Class
     */
    public static function getMyClass(): \My\Class
    {
        return self::buildObject('\My\Class');
    }
}

The AbstractContainer::buildObject() method takes 3 args:, (*9)

  • The class name
  • An array of class constructor values
  • A namespace string

See OsfContainer, ZendContainer and VendorContainer for more examples., (*10)

The Versions

21/04 2018

3.0.x-dev

3.0.9999999.9999999-dev https://github.com/osflab/container

OSF dynamic object container mechanism

  Sources   Download

AGPL-3.0-or-later

The Requires

 

The Development Requires

by Avatar Guillaume Ponçon

21/04 2018

dev-master

9999999-dev https://github.com/osflab/container

OSF dynamic object container mechanism

  Sources   Download

AGPL-3.0-or-later

The Requires

 

The Development Requires

by Avatar Guillaume Ponçon

26/02 2018

3.0.0

3.0.0.0 https://github.com/osflab/container

OSF dynamic object container mechanism

  Sources   Download

AGPL-3.0-or-later

The Requires

 

The Development Requires

by Avatar Guillaume Ponçon