This repository serves as a starting point for creating a Symfony-based API project. It is designed to help you quickly set up the basic structure and dependencies required for building robust APIs with Symfony.
Before you begin, ensure you have the following installed on your system:
- PHP 8.2 or higher
- Composer - Installation Guide
- Docker - Installation Guide
- Docker Compose - Installation Guide
-
Clone the repository:
git clone https://github.com/nanorocks/php-symfony-mailhog-mysql-rabbitmq.git
-
Navigate to the project directory:
cd php-symfony-mailhog-mysql-rabbitmq
-
Copy the example environment file and adjust as needed:
cp .env.dist .env
Update the necessary configurations in the
.env
file, such as Symfony database settings. -
Build and start the Docker containers:
docker-compose up -d
The Symfony application will be accessible at
http://localhost:8080
.
The PHP-FPM service runs the Symfony application.
The Nginx service serves as the web server, forwarding requests to the PHP-FPM service.
Mailhog is included for email testing purposes. The Mailhog web UI can be accessed at http://localhost:8025
.
The MySQL service provides the database for the Symfony application.
RabbitMQ is included as a message broker for your Symfony application.
Symfony logs are stored in the var/logs
directory of the Symfony application.
The project follows a standard Symfony structure, with additional directories for API-specific components:
- config/: Contains configuration files.
- public/: The web server's root directory.
- src/: Your application source code.
- Controller/: API controllers.
- Entity/: Doctrine entities.
- Repository/: Doctrine repositories.
- tests/: PHPUnit test cases.
- var/: Temporary files (cache, logs, etc.).
- vendor/: Composer dependencies.
- .env: Environment configuration.
- .gitignore: List of files and directories to be ignored by Git.
- composer.json: Composer package definition.
- phpunit.xml.dist: PHPUnit configuration.
Feel free to contribute to this project by opening issues or submitting pull requests. Your feedback and contributions are highly appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.