https://github.com/efureev/laravel-services
https://github.com/efureev/laravel-services
di laravel services
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/efureev/laravel-services
- Owner: efureev
- License: mit
- Created: 2018-10-31T19:04:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-31T19:41:02.000Z (over 6 years ago)
- Last Synced: 2025-01-15T09:02:46.637Z (3 months ago)
- Topics: di, laravel, services
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Introduction
Services is collection of your inner services.
**ONLY PHP 7.1 and upper**
## Install
```
composer require efureev/services
```Insert in `providers` sections into `config/app.php`:
```
\Fureev\Services\ServiceProvider::class,
```## Config (config/di.php)
All properties at your Provider class has defined into drivers section for concrete driver.```php
'testing', // Name component in DI. Default = 'services'
'drivers' => [
'user' => [
// Allow load driver into app DI. Expl: app('services.user')
'defer' => false
],
'test' => [
// if it's not defined - use class CustomProvider
'provider' => \App\Services\Test\Provider::class,
'count' => 1 // local property into class \App\Services\Test\Provider
],
'defer' => [
],
]
];
```You may redefine ServiceManager and use build-in method:
```php
buildProvider(UserProvider::class, $driverConfig);
}
}
```and rebind `services` into DI. Example, in `\App\Providers\AppServiceProvider` in register method:
```php
$this->app->instance(app('config')->get(ServiceManager::configSection() . '.name'), new ServiceManager($this->app));
```