2017 © Pedro Peláez
 

library lazy-container

Lazy loading PSR-11 container decorator

image

snapshotpl/lazy-container

Lazy loading PSR-11 container decorator

  • Tuesday, March 20, 2018
  • by snapshotpl
  • Repository
  • 3 Watchers
  • 16 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Lazy-Container Build Status

Lazy loading for PSR-11 container, (*1)

Get lazy loadable object from any PSR-11 container! Powered by Proxy Manager, (*2)

Usage

// Build LazyLoadingValueHolderFactory as you want
$lazyLoadingFactory = new ProxyManager\Factory\LazyLoadingValueHolderFactory();

// Prepare you favorite container
$pimple = new Pimple\Container();
$pimple['service'] = function ($container) {
    return new HeavyService($container->get('dependency'));
};

// Create map (service name => class name) where you choose which services should be lazy loaded
$classMap = ['service' => HeavyService::class];

// Put all things to LazyContainer
$container = new LazyContainer($pimple, $lazyLoadingFactory, $classMap);

// Use LazyContainer exactly same like other PSR-11 container (thanks for interface)
$service = $container->get('service');

// Now $service is a proxy, so HeavyService wasn't created yet

// After first usage of $service is real HeavyService!
$result = $service->doSomething();

Installation

You can install this package through Composer:, (*3)

composer require snapshotpl/lazy-container

The Versions

20/03 2018

dev-master

9999999-dev

Lazy loading PSR-11 container decorator

  Sources   Download

BSD 3-Clause

The Requires

 

The Development Requires

20/03 2018

1.2.0

1.2.0.0

Lazy loading container decorator

  Sources   Download

BSD 3-Clause

The Requires

 

The Development Requires

20/03 2018

dev-upgrade

dev-upgrade

Lazy loading container decorator

  Sources   Download

BSD 3-Clause

The Requires

 

The Development Requires

23/10 2016

1.1.0

1.1.0.0

Lazy loading container decorator

  Sources   Download

BSD 3-Clause

The Requires

 

The Development Requires

14/04 2016

dev-lazy-inception

dev-lazy-inception

Lazy loading container decorator

  Sources   Download

BSD 3-Clause

The Requires

 

The Development Requires

09/04 2016

1.0.0

1.0.0.0

Lazy loading container decorator

  Sources   Download

BSD 3-Clause

The Requires

 

The Development Requires