Skip to content

igorbalden/sf5-api

Repository files navigation

Symfony 5 Api Starter

The "Symfony 5 Api Starter" can be used as the base code to start an API using jwt authentication.

Requirements

Installation

Create a directory, and clone the repo in it.

git clone https://github.com/igorbalden/sf5-api.git ./

composer install

Copy ./env to .env.local. Edit it, if so needed.

Create a MySql database and run the migration.

Usage

Option 1.

If you have installed Symfony binary, run this command:

$ cd my_project/
$ symfony serve -d

Option 2.

Start Docker by

$ cd my_project/
$ docker-compose up -d

Then start the client application to use it,
or query it with a tool like curl or similar.

If you don't have the Symfony binary installed, run php -S localhost:8000 -t public/
to use the built-in PHP web server or configure a web server like Nginx or Apache to run the application.

Tests

Execute this command to run tests:

$ cd my_project/
$ ./bin/phpunit