A Symfony-based project implementing a Hexagonal Architecture for modular and extensible development
- Version Symfony 7.0.*
This project is a template for creating a Symfony application using the hexagonal architecture. It is based on the php-ddd-example project, but with some changes and improvements.
git clone https://github.com/tonicarreras/symfony-base.git
# Build and run Docker containers
make install
## Recommended: With passphrase
make jwt-pp-config
# Without passphrase
make jwt-config
# Enter the Docker container's terminal
make sh
- Database: symfony-database
- user: root
- password: root
You can access the application in your web browser at:
[!IMPORTANT]
Required PHP extensions
This project requires the following PHP extensions to be installed and enabled:
- ext-ctype: Used for character type checking.
- ext-iconv: For character encoding conversion.
- ext-pdo: Essential for PHP Data Object (PDO) database connections.
composer install
You will need to configure the database connection by modifying the DATABASE_URL in the .env file to match your MySQL settings.
php bin/console doctrine:migrations:migrate
[!IMPORTANT] LexikJWTAuthenticationBundle requires a private and public key to sign and verify the JWT token. JWT_PASSPHRASE=your_secret_passphrase on .env file. This is to protect /api routes with JWT authentication.
## Recommended: With passphrase
mkdir -p config/jwt
openssl genrsa -out config/jwt/private.pem -aes256 4096
openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem
# Without passphrase
mkdir -p config/jwt
openssl genrsa -out config/jwt/private.pem 4096
openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem
#Symfony CLI
symfony server:start
For more details on setting up Symfony, please refer to the official Symfony documentation
This project has benefited from ideas and code from the following projects and resources: