This project is a simple API for catalog of products and a cart to add the products.
It's based on Symfony and therefore requires symfony tools.
- Make sure your PHP version is 8.0+, install PostgreSQL 13+
- Install Symfony CLI: https://symfony.com/download
- Install Composer: https://getcomposer.org/download
- Check requirements:
symfony check:requirements
- Fill actual database credentials in
.env.local
(overrideDATABASE_URL
) - Run composer:
symfony composer install
- Run the server:
symfony server:start
You may use Postman collection of requests (./Simple Shop API.postman_collection.json
) to see how to operate the API.
Run PHP CS Fixer to validate the code
symfony composer cs:dry #to only show issues
symfony composer cs:fix #to change files
- Fill new database credentials and a database name in
.env.test.local
(overrideDATABASE_URL
) - Create a test database and fill it with data:
symfony composer test:create-env
- Then you will be able to run Unit, Functional, or both tests:
symfony composer test:unit symfony composer test:functional symfony composer test:all
- Add Docker
- Add more tests
- Hide the Product API under some authentication system
- Add Swagger
- Add more static analyzers
- Something else