2017 © Pedro Peláez
 

library instantiator

image

stratadox/instantiator

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

The README.md

Instantiator

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version License, (*1)

Lightweight instantiator., (*2)

Installation

Install using composer require stratadox/instantiator, (*3)

What is this?

The Instantiator module provides a most simplistic way of producing empty instances., (*4)

An Instantiator is configured to produce instances of a specific class. In this way it differs from most other instantiator packages, which usually specify the class to instantiate as method parameter., (*5)

Basic usage

<?php
use Stratadox\Instantiator\ObjectInstantiator;

$provideFoo = ObjectInstantiator::forThe(Foo::class);

assert($provideFoo->instance() instanceof Foo);
assert(Foo::class === $provideFoo->class());

How does it work?

The ObjectInstantiator class basically just extends ReflectionClass in order to alias its newInstanceWithoutConstructor method. In cases where this instantiation method fails, for instance when a final class inherits from an internal class, deserialization is used instead., (*6)

Alternatively, this module includes a PredefinedInstanceProvider. This one isn't really an instantiator, but rather an iterator, but that does not stop it from implementing the Instantiator interface., (*7)

The Versions

17/06 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

17/06 2018

v0.1.3

0.1.3.0

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

16/04 2018

v0.1.2

0.1.2.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

16/04 2018

v0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

13/04 2018

v0.1

0.1.0.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires