2017 © Pedro Peláez
 

library container

Unity framework dependency manager.

image

unity/container

Unity framework dependency manager.

  • Saturday, November 4, 2017
  • by e200
  • Repository
  • 1 Watchers
  • 2 Stars
  • 4 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Unity/Container

An out of box dependency manager for PHP projects., (*1)

Introduction

Let's take a look at this class:, (*2)

class Logger
{
    protected $fileLogger;

    public function __construct(FileLogger $fileLogger)
    {
        $this->fileLogger = $fileLogger;
    }

    public function log($message)
    {
        return $this->fileLogger->log($message);
    }
}

The problem with this class is that it's coupled to a specific Logger., (*3)

What if one day we change our mind and want to start sending our logs via email? We need to get back to this class and change the logger from FileLogger to EmailLogger, (*4)

Refatoring:, (*5)

class Logger
{
    protected $driver;

    public function __construct(LoggerDriverInterface $driver)
    {
        $this->driver = $driver;
    }

    public function log($message)
    {
        return $this->driver->load($message);
    }
}

That way our class can accept any kind of file drivers and is coupled to a contract instead of a concrete implememnation., (*6)

But what if you have a lot of classes to manage?, (*7)

There's where the container comes., (*8)

Installation

composer require unity/container

Usage

The Versions

04/11 2017

dev-master

9999999-dev

Unity framework dependency manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

04/11 2017

dev-analysis-zYg7BY

dev-analysis-zYg7BY

Unity framework dependency manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/10 2017

dev-analysis-q5ERJl

dev-analysis-q5ERJl

Unity framework dependency manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/09 2017

1.0.0-beta.1

1.0.0.0-beta1

The Unity framework psr-11 implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

19/09 2017

1.0.0-beta.0

1.0.0.0-beta0

The Unity framework psr-11 implementation

  Sources   Download

MIT

The Requires

 

The Development Requires