Download the PHP package yevhenlisovenko/nano-service without Composer
On this page you can find all versions of the php package yevhenlisovenko/nano-service. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yevhenlisovenko/nano-service
More information about yevhenlisovenko/nano-service
Files in yevhenlisovenko/nano-service
Package nano-service
Short Description nano-service
License MIT
Homepage https://github.com/yevhenlisovenko/nano-service
Informations about the package nano-service
Nano-Service: Event-Driven Microservices Package for PHP
Introduction
Nano-Service is a PHP package designed for building event-driven microservices using RabbitMQ as a message broker. This package provides an abstraction layer for publishing and consuming events, facilitating communication between microservices in a loosely coupled architecture.
Features
- Publish and consume messages through RabbitMQ
- Event-driven architecture for microservices
- Message standardization using
NanoServiceMessage
- Scalable & decoupled services with message queues
- Flexible integration with any PHP project
Installation
To install the package via Composer, run:
Ensure that RabbitMQ is installed and running. You can use Docker to start RabbitMQ quickly:
Access RabbitMQ at http://localhost:15672 (username: guest
, password: guest
).
Usage
1. Creating a Publisher (Event Emitter)
The NanoPublisher
class allows you to send messages to a specific queue.
2. Creating a Consumer (Event Listener)
The NanoConsumer
class listens for incoming messages and processes them.
3. Standardizing Messages
The NanoServiceMessage
class ensures consistent message formatting across services.
4. Implementing a Microservice
The NanoServiceClass
helps build services that listen for messages and respond accordingly.
Configuration
You can configure RabbitMQ settings via environment variables:
Deployment
To deploy your microservices, you can use Docker:
Then build and run the service:
Future Enhancements
- Support for Kafka, Redis Pub/Sub, and Google Pub/Sub
- More examples and tutorials
- Automatic reconnection to RabbitMQ in case of failure
License
Nano-Service is open-source and licensed under the MIT License.
Contributing
Feel free to open an issue or submit a pull request to improve the package!
All versions of nano-service with dependencies
ext-curl Version *
league/statsd Version ^2.0
myclabs/php-enum Version ^1.8
php-amqplib/php-amqplib Version ^3.5
ramsey/uuid Version ^3 || ^4
spatie/crypto Version ^2.0