- About project
- Installation
- Configure environment variables and create database
- Run project
- Run Tests
- Future improvements
- Symfony 4.4
- Packages installed: Symfony Flex, Doctrine, Security, NelmioApiDocBundle, MakerBundle, DoctrineFixturesBundle and PHPUnit among others
- DDD and Hexagonal architecture
- Best practices: Clean code, PHP Standards Recommendations (PSR), SOLID principles and design patterns
- Unit testing
- Exceptions handler
- Database full dump with test data included in
migrations
folder
Clone repository:
git clone https://github.com/burus86/api-ddd-template.git
Install dependencies:
cd api-ddd-template
composer install
Rename filename .env.dist
as .env
and edit DATABASE_URL
value with database parameters
Execute the following commands to create an empty database with the name specified in .env
filename:
php bin/console doctrine:database:create
php bin/console doctrine:schema:update --force
Execute the following command in order to dump fake data in database tables:
php bin/console doctrine:fixtures:load
Alternatively, you can either import the db-api-ddd-template-full.sql
file, included in migrations
folder, to create and populate the database schema, however this file might not be up to date.
Follow instructions to install a Symfony Local Web Server and then open a new tab with the following URL:
Alternatively, if you use XAMPP, open the URL:
http://localhost/api-ddd-template/public/api/doc
All API endpoints require a X-AUTH-TOKEN
in header, with a value equal to field api_token in user table. Example: cU70Sbr0qKrUQHE0tw60XQVMwBP8hJrdRMY61xhX
vendor/bin/phpunit
- Upgrade Symfony to latest stable version: 5.3
- Add docker configuration files
- Add JWT authentication, which replace current API Key defined in user
- Create application tests, to check the integration of all the different layers of the application.
- Install serializer component to normalize objects as JSON and hide specific fields
- Use DoctrineMigrationsBundle
- Add uuid field for each model and hide id field on JSON responses