2017 © Pedro PelĂĄez
 

library services-manager

Services manager written in PHP 7

image

codeinc/services-manager

Services manager written in PHP 7

  • Wednesday, June 6, 2018
  • by joanfabregat
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 1 Dependents
  • 2 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 13 % Grown

The README.md

Services manager

The library is intended to be used as a services manager. It is written in PHP 7.1., (*1)

Usage

<?php
use CodeInc\ServicesManager\ServicesManager;
use CodeInc\ServicesManager\ServiceInterface;

// a first service
class MyFirstService implements ServiceInterface 
{
    public function hello(string $name):void
    {
        echo sprintf("Hello %s!", $name);
    }
}

// a second service using the first service
class MySecondService implements ServiceInterface
 {
    /** @var MyFirstService */
    private $myFirstClass;

    public function __construct(MyFirstService $myFirstClass) 
    {
        $this->myFirstClass = $myFirstClass;
    }

    public function helloWorld():void
    {
        $this->myFirstClass->hello("World");
    }
}

// calling the second service, the service manager is going to first instantiated MyFirstService
// then instantiate MySecondService with MyFirstService as a parameter.
$serviceManager = new ServicesManager();
$mySecondService = $serviceManager->getService(MySecondService::class);
$mySecondService->helloWorld();

// you also can add external objects to makes them available to the servides,
// for instance a PSR-7 ServerRequest object or Doctrine's EntityManager.
$serviceManager->addService($entityManager);

// the service manager will pass the instance of the service manager added
// using addService()
class MyThirdService {
    public function __construct(EntityManager $entityManager) { }
}

Installation

This library is available through Packagist and can be installed using Composer:, (*2)

composer require codeinc/services-manager

License

This library is published under the MIT license (see the LICENSE file)., (*3)

The Versions

06/06 2018

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/CodeIncHQ/ServicesManager

Services manager written in PHP 7

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

06/06 2018

2.0.0-beta.1

2.0.0.0-beta1 https://github.com/CodeIncHQ/ServicesManager

Services manager written in PHP 7

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

22/03 2018

dev-master

9999999-dev https://github.com/CodeIncHQ/ServicesManager

Services manager written in PHP 7

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

22/03 2018

1.0.7

1.0.7.0 https://github.com/CodeIncHQ/ServicesManager

Services manager written in PHP 7

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

22/03 2018

1.x-dev

1.9999999.9999999.9999999-dev https://github.com/CodeIncHQ/ServicesManager

Services manager written in PHP 7

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

22/03 2018

1.0.6

1.0.6.0 https://github.com/CodeIncHQ/ServicesManager

PHP service manager

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

22/03 2018

1.0.5

1.0.5.0 https://github.com/CodeIncHQ/ServicesManager

PHP service manager

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

13/03 2018

1.0.4

1.0.4.0 https://github.com/CodeIncHQ/ServicesManager

PHP service manager

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

13/03 2018

1.0.3

1.0.3.0 https://github.com/CodeIncHQ/ServicesManager

PHP service manager

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

13/03 2018

1.0.2

1.0.2.0 https://github.com/CodeIncHQ/ServicesManager

PHP service manager

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

13/03 2018

1.0.1

1.0.1.0 https://github.com/CodeIncHQ/ServicesManager

PHP service manager

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

12/03 2018

1.0.0

1.0.0.0 https://github.com/CodeIncHQ/lib-instantiator

PHP objects instantiator

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires