2017 © Pedro Peláez
 

library registry

A simple and lightweight registry

image

imj/registry

A simple and lightweight registry

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

A simple and lightweight registry

Build Status Latest Stable Version Total Downloads License, (*1)

Installation

composer require imj/registry

Basic Usage

use Imj\Registry;
$r = new Registry();
$r->set('foo', 'a');
echo $r->get('foo'); // a
echo $r['foo']; // a

$r['bar'] = 'b';
echo $r['bar']; // b

lazy load, (*2)

use Imj\Registry;

class Foo
{
  public function sayHi()
  {
    return 'hi';
  }
}

$r->singleton('foo_class', function($c){
  return new Foo();
});
echo $r->get('foo_class')->sayHi(); // hi
echo $r->foo_class->sayHi(); // hi

service register, (*3)

use Imj\ServiceProviderInterface;
use Imj\Registry;

class LibraryProvider implements ServiceProviderInterface
{
  public function register(Registry $registry)
  {
    $registry->singleton('bar_class', function($c){
      return new Bar();
    });
  }
}

class Bar
{
  public function sayHey()
  {
    return 'hey';
  }
}

$r->register(new LibraryProvider());
echo $r->bar_class->sayHey(); // hey

License

licensed under the MIT License - see the LICENSE file for details, (*4)

The Versions

26/05 2017

dev-master

9999999-dev

A simple and lightweight registry

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

registry

26/05 2017

v1.0.3

1.0.3.0

A simple and lightweight registry

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

registry

21/06 2016

v1.0.2

1.0.2.0

A simple and lightweight registry

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

registry

21/06 2016

v1.0.1

1.0.1.0

A simple and lightweight registry

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

registry

21/06 2016

v1.0.0

1.0.0.0

A simple and lightweight registry

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

registry