bapcat / services
0.3
2019-01-03 21:26 UTC
Requires
- php: ^7.1
- bapcat/phi: ^1.0 || ^2.0 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^7.5
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-10-15 06:06:17 UTC
README
Services
This package provides a controlled boot environment for cross-package dependencies.
Installation
Composer
Composer is the recommended method of installation for BapCat packages.
$ composer require bapcat/services
GitHub
BapCat packages may be downloaded from GitHub.
Features
Registration
The main use for Services is to register IoC bindings.
<?php namespace BapCat\CoolLogger; use BapCat\CoolLogger\Logger; use BapCat\Interfaces\Ioc\Ioc; class LoggingServiceProvider implements ServiceProvider { private $ioc; public function __construct(Ioc $ioc) { $this->ioc = $ioc; } public function register() { // Make Logger a singleton $this->ioc->singleton(Logger::class, Logger::class); // Bind the bap.log alias to the Logger singleton $this->ioc->bind('bap.log', Logger::class); } }