Skip to content

kdakhli/mini-site-rest-api

Repository files navigation

mini-site-api

The purpose of this project is to provide a standard REST JSON-API that would allow a mobile application or a full frontend website to display a mini site.

This project is a Symfony 4 based app and uses ADR as design pattern.

In this project, I did not use the services, I put all of them in the controller, it is not a good practice, the goal being to make a mini project to mount the implementation of a REST API with the ADR design pattern.

soon I will do the same exercise with a clean-archi or Hexagonal architecture with PHP8 and Symfony6

This project uses Swagger for the API documentation.

Installation

  • clone the project : [email protected]:kdakhli/mini-site-rest-api.git

  • inside the project folder run : composer install

  • setup your database by changing this line in .env file DATABASE_URL=mysql://db_user:[email protected]:3306/db_name

  • connect the db by running the following command at the root of the project : php bin/console doctrine:database:create

  • run this command in order to update the database schema : php bin/console doctrine:migrations:migrate

  • now since the database is ready , we can add some data fixtures : php bin/console doctrine:fixtures:load

  • just start the build-in symfony server to begin exploring the api : php bin/console server:start then go to http://localhost:8000 to use the API Sandbox

====> Enjoy :)

Testing

  • setup your test database by changing this line in .env.test file DATABASE_URL=mysql://db_user:[email protected]:3306/db_name

  • connect the db by running the following command at the root of the project : php bin/console doctrine:database:create --env=test

  • run this command in order to update the database schema : php bin/console doctrine:migrations:migrate --env=test

  • to start the functional tests type the following at the root of the project folder : php bin/phpunit

====> If you sees this OK (8 tests, 29 assertions) then everything works fine :p

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published