Welcome to Symfony-Translation-Microservice
! This is a simple translation microservice built with Symfony implementing DDD architecture.
- PHP 8.1: One of the latest version of PHP, ensuring the best performance and security.
- Symfony: Built on top of Symfony, one of the most efficient PHP frameworks, ensuring robust performance and modular codebase.
- MySQL: A reliable relational database system, ensuring data integrity and efficient retrieval.
- Doctrine: An ORM for PHP that provides database abstraction, ensuring seamless data manipulation and persistence.
- RabbitMQ: A message broker that implements the Advanced Message Queuing Protocol (AMQP), ensuring reliable message delivery.
- Redis: An in-memory data structure store used as a caching layer to speed up data access.
- PHPUnit: A popular PHP testing framework that ensures our code runs as expected and is free from regressions.
- Docker: An OS-level virtualization tool that packages our app and its dependencies into containers for consistent and easy deployment.
- Composer: A dependency manager for PHP, ensuring the project has all the necessary libraries and manages them with ease.
- Nginx: A high-performance web server that serves static and dynamic content on the web.
Docker makes it easy to wrap your applications and services in containers so you can run them anywhere. Our project is already Docker-ready for you!
-
Navigate to the Docker Directory
cd .docker
-
Build and Start the Containers
Note: Ensure Docker is running on your system.
docker-compose up -d
This command will build the containers based on the services defined in
docker-compose.yml
and the respectiveDockerfile
s located in the service directories. -
Check the Running Containers
docker ps
You should see your services running. If you face any issues, logs can be checked using:
docker-compose logs -f [service-name]
-
Stopping the Containers
Once you're done, you can stop the containers by running:
docker-compose down
With Docker, you can ensure the application runs in the same environment regardless of where Docker is running. It simplifies deployment, scaling, and testing.
-
Clone the Repository
git clone https://github.com/your-username/Symfony-Translation-Microservice.git
-
Navigate into the Directory
cd Symfony-Translation-Microservice
-
Install Dependencies
composer install
-
Run the Service
symfony server:start
That's it! Your translation microservice should now be running on http://127.0.0.1:8000
.
Send a POST request to /translate
endpoint with source and target language codes and the text you want to translate.
Example:
curl -X POST -H "Content-Type: application/json" \
-d '{"source": "en", "target": "fr", "text": "Hello World!"}' \
http://127.0.0.1:8000/translate