PHPackages                             spiechu/lazy-pimple - 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. spiechu/lazy-pimple

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

spiechu/lazy-pimple
===================

Lazy service definitions for Pimple DI container.

0.7(7y ago)486MITPHPPHP ^7.1

Since Feb 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/spiechu/lazy-pimple)[ Packagist](https://packagist.org/packages/spiechu/lazy-pimple)[ Docs](https://github.com/spiechu/lazy-pimple)[ RSS](/packages/spiechu-lazy-pimple/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

Lazy Pimple
===========

[](#lazy-pimple)

Lazy service definitions for [Pimple DI container](http://pimple.sensiolabs.org/).

Travis build status: [![Build Status](https://camo.githubusercontent.com/388c7e316e2ba4360377fa8fd3d747bdfb6f12bb8a2cbb2d64c3c009ea15ef1d/68747470733a2f2f7472617669732d63692e6f72672f737069656368752f6c617a792d70696d706c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/spiechu/lazy-pimple)

Other fancy badges: [![Scrutinizer Code Quality](https://camo.githubusercontent.com/579bed3e7b9efa92540d5b262111de7a49f7f1822fd242bbf1d10cc71ea4ce90/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f737069656368752f6c617a792d70696d706c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spiechu/lazy-pimple/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/44ecdddf1815753b9bf417e64780f76373f54d0240e24d0fae30d8b287b9689c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f737069656368752f6c617a792d70696d706c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spiechu/lazy-pimple/?branch=master)

Intro
-----

[](#intro)

When using Pimple DIC, there is sometimes need to lazy load service and instantiate it only when needed. What's more, there is also possibility to lazy load event subscribers. (Now you'll see why `\Symfony\Component\EventDispatcher\EventSubscriberInterface` has static interface).

Under the hood this library uses [Proxy Manager](https://github.com/Ocramius/ProxyManager). Object's proxy is firstly generated. Until instance method call is needed, the proxy is being used. This means even static calls don't need object's instance and are called by proxy.

Installation
------------

[](#installation)

Simplest way is to add `"spiechu/lazy-pimple": "~0.1"` to your `composer.json`.

The minimal configuration for lazy loads to work is to add two definitions to your Pimple:

```
