2017 © Pedro Peláez
 

library tale-factory

A small and lightweight implementation of the factory pattern

image

talesoft/tale-factory

A small and lightweight implementation of the factory pattern

  • Saturday, May 21, 2016
  • by TorbenKoehn
  • Repository
  • 3 Watchers
  • 0 Stars
  • 17,234 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

Tale Factory

What is Tale Factory?

A generic implementation of the factory pattern., (*1)

Installation

composer require talesoft/tale-factory

Usage

use Tale\Factory;

interface AdapterInterface
{
    public function sayHello(): void;
}

class TestAdapter
{
    private $message;

    public function __construct(string $message)
    {
        $this->message = $message;
    }

    public function sayHello(): void
    {
        echo $this->message;
    }
}

$factory = new Factory(
    AdapterInterface::class,
    ['Hello from adapter!'],
    [
        'test' => TestAdapter::class
    ]
);


$instance = $factory->get('test');
$instance->sayHello(); //"Hello from adapter!"

TODO: More docs., (*2)

The Versions

21/05 2016

dev-master

9999999-dev http://docs.talesoft.io/tale-framework/tale/factory

A small and lightweight implementation of the factory pattern

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Torben Koehn

factory

20/05 2016

0.1

0.1.0.0 http://docs.talesoft.io/tale-framework/tale/factory

A small and lightweight implementation of the factory pattern

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Torben Koehn

factory