https://github.com/bemit/satellite
https://github.com/bemit/satellite
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/bemit/satellite
- Owner: bemit
- License: mit
- Created: 2019-11-19T19:38:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-19T19:27:46.000Z (over 3 years ago)
- Last Synced: 2025-02-15T00:32:55.349Z (over 1 year ago)
- Language: PHP
- Size: 88.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Orbiter\Satellite
[](https://packagist.org/packages/orbiter/satellite)
[](https://packagist.org/packages/orbiter/satellite)
[](https://codecov.io/gh/bemit/satellite)
[](https://packagist.org/packages/orbiter/satellite)
[](https://github.com/bemit/satellite/actions)
[](https://packagist.org/packages/orbiter/satellite)
- **PSR-14** Event Dispatcher and Listener
- using [`InvokerInterface`](https://github.com/PHP-DI/Invoker/blob/2.0.0/src/InvokerInterface.php) to execute anything, **PSR-11** compatible
Check [satellite-app](https://github.com/bemit/satellite-app) for a ready to use template, or install just this event library:
```shell
composer require orbiter/satellite
```
Dependencies, using [`PHP-DI`](https://php-di.org/) here, but possible with any PSR-11 container and any implementation of [`InvokerInterface`](https://github.com/PHP-DI/Invoker):
```injectablephp
use function DI\autowire;
use function DI\get;
$dependencies = [
Satellite\Event\EventListenerInterface::class => autowire(Satellite\Event\EventListener::class),
Psr\EventDispatcher\ListenerProviderInterface::class => get(Satellite\Event\EventListenerInterface::class),
Satellite\Event\EventDispatcher::class => autowire()
->constructorParameter('listener', get(Psr\EventDispatcher\ListenerProviderInterface::class))
->constructorParameter('invoker', get(Invoker\InvokerInterface::class)),
Psr\EventDispatcher\EventDispatcherInterface::class => get(Satellite\Event\EventDispatcher::class),
];
```
For full invocation PSR-11 injection based on `Reflection`, set up the `Invoker` with the included `InvokerTypeHintContainerResolver`:
```injectablephp
/**
* @var $invoker \Invoker\Invoker
*/
$invoker = $container->get(\Invoker\Invoker::class);
$invoker->getParameterResolver()->prependResolver(
new Satellite\InvokerTypeHintContainerResolver($container)
);
```
## Dev Notices
Commands to set up and run e.g. tests:
```bash
# on windows:
docker run -it --rm -v %cd%:/app composer install
docker run -it --rm -v %cd%:/var/www/html php:8.1-cli-alpine sh
docker run --rm -v %cd%:/var/www/html php:8.1-cli-alpine sh -c "cd /var/www/html && ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php"
# on unix:
docker run -it --rm -v `pwd`:/app composer install
docker run -it --rm -v `pwd`:/var/www/html php:8.1-cli-alpine sh
docker run --rm -v `pwd`:/var/www/html php:8.1-cli-alpine sh -c "cd /var/www/html && ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php"
```
## Versions
This project adheres to [semver](https://semver.org/), **until `1.0.0`** and beginning with `0.1.0`: all `0.x.0` releases are like MAJOR releases and all `0.0.x` like MINOR or PATCH, modules below `0.1.0` should be considered experimental.
## License
This project is free software distributed under the [**MIT LICENSE**](LICENSE).
### Contributors
By committing your code to the code repository you agree to release the code under the MIT License attached to the repository.
***
Maintained by [Michael Becker](https://i-am-digital.eu)