innmind / homeostasis-bundle
App health regulator bundle
Requires
- php: ~7.1
- innmind/homeostasis: ^2.0
- symfony/config: ~3.0
- symfony/dependency-injection: ~3.0
- symfony/http-kernel: ~3.0
- symfony/yaml: ~3.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2022-02-01 13:08:07 UTC
README
master |
develop |
---|---|
Installation
composer require innmind/homeostasis-bundle
Enable the bundle by adding the following line in your app/AppKernel.php of your project:
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Innmind\HomeostasisBundle\InnmindHomeostasisBundle, ); // ... } // ... }
Then you need to specify the an actuator:
innmind_homeostasis: actuator: service_id
The actuator service will need to implement the interface Innmind\Homeostasis\Actuator
.
By default it uses the cpu and symfony logs as factors, but you can your own via the factors
config key. To add a factor you need to create a service tagged with innmind.homeostasis.factor
and with an alias
attribute, this alias will need to be a key in the factors
config. If you define a factory on your service then the data under your alias in the config will be injected in the factory service.
Usage
To trigger the whole mechanism you just have to call the following code somewhere in your app (for exemple on console.terminate
when an amqp consumer finished his job).
$container->get('innmind.homeostasis.regulator')();