https://github.com/nanorocks/symfony-microservices
Microservices architecture with symfony framework
https://github.com/nanorocks/symfony-microservices
docker microservice php rabbitmq redis symfony5
Last synced: about 1 month ago
JSON representation
Microservices architecture with symfony framework
- Host: GitHub
- URL: https://github.com/nanorocks/symfony-microservices
- Owner: nanorocks
- Created: 2023-12-13T00:49:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-13T01:12:02.000Z (over 2 years ago)
- Last Synced: 2025-01-09T20:11:55.746Z (over 1 year ago)
- Topics: docker, microservice, php, rabbitmq, redis, symfony5
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚀 Microservices Architecture with RabbitMQ, Redis, and Symfony PHP
## Overview
This project showcases a sophisticated microservices architecture, utilizing Symfony PHP for each microservice, RabbitMQ as a dynamic message broker, and Redis for efficient caching. The architecture comprises two pivotal Symfony microservices: User & Event Microservice and Betting Microservice. RabbitMQ orchestrates asynchronous communication between these microservices, while Redis optimizes data retrieval speed, enhancing overall performance and mitigating database load.
## 🛠️ Components
1. **User & Event Microservice:**
- Manages user data and sports events using Symfony PHP.
- Publishes user-related events (e.g., customization) and sports events data.
- Leverages Redis for caching frequently accessed user data and sports events.
2. **Betting Microservice:**
- Handles betting-related data using Symfony PHP.
- Consumes user-related events and sports events data, then publishes betting data.
- Takes advantage of Redis for caching frequently accessed betting-related data.
3. **RabbitMQ:**
- Serves as a dynamic message broker between the User & Event Microservice and Betting Microservice.
- Facilitates seamless asynchronous communication.
4. **Redis:**
- Employs caching for frequently accessed data within the User & Event Microservice and Betting Microservice.
- Enhances data retrieval speed and reduces the load on databases.
## 🌐 Diagram Overview
```plaintext
+----------------------+ +----------------------+
| User & Event | | Betting |
| Microservice | | Microservice |
+-----------^----------+ +----------^-----------+
| |
| Publishes events, user data |
| |
v v
+---------------------+ +-----------------------------+
| Redis Cache | | Redis Cache |
| | | |
+---------------------+ +-----------------------------+
| |
| Caches user and sports events |
| data |
| |
+-----------+--------------------------------+------------------+
| RabbitMQ Message Queue |
+----------------------------------------------------------------+
|
| Consumes events, user data, and publishes betting data
|
+-----------v----------+ +-----------------------------+
| User Entity | | Bet & Trend Entity |
| Event Entity | | |
+---------------------+ +-----------------------------+
```
## 🚀 Usage
1. **Clone the Repository:**
```bash
git clone https://github.com/yourusername/your-repo.git
```
2. **Install Dependencies:**
- Navigate to each Symfony microservice directory and run:
```bash
composer install
```
3. **Configure RabbitMQ and Redis:**
- Update configuration files in each Symfony microservice to point to your RabbitMQ and Redis instances.
4. **Run Microservices:**
- Start each Symfony microservice:
```bash
php bin/console server:start
```
## ⚙️ Configuration
- Adjust Symfony configuration files (config/packages/*.yaml) in each microservice to set environment-specific variables for RabbitMQ and Redis connections.
## 🤝 Contributions
Contributions are welcome! Please follow our [Contribution Guidelines](CONTRIBUTING.md).
## 📝 License
This project is licensed under the [MIT License](LICENSE).