Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

webqard/resto-api

Repository files navigation

Resto API

This project has been moved to https://gitlab.com/webqard/resto This repository will no longer be maintained.

This is a restaurant API.

License Type coverage Minimum PHP version

This API is not fit for production in its current state. Its features may changed without warning.

Installation

Download the project :

user@host ~$ cd [PATH_WHERE_TO_PUT_THE_PROJECT] # E.g. ~/projects/
user@host projects$ git clone https://github.com/webqard/resto-api.git
user@host projects$ cd resto-api

Copy the variables in the .env.dist file to your .env* file and fill in the values.

Install PHP dependencies :

user@host resto-api$ composer install -o [--no-dev]

The "--no-dev" option is for the production environment.

Generate API

user@host resto-api$ ./vendor/bin/openapi -o ./public/api.json ./src/

Create the database

user@host resto-api$ ./bin/console doctrine:database:create [-e test]
user@host resto-api$ ./bin/console make:migration [-e test]
user@host resto-api$ ./bin/console doctrine:migrations:migrate [--no-interaction] [-e test]

The "-e test" option is to for the test environment which uses Sqlite.

Generate the JWT keys

user@host resto-api$ ./bin/console lexik:jwt:generate-keypair [-n] [--skip-if-exists] [--overwrite] [-e test]

Continuous integration

First, you need to install phive dependencies :

user@host resto-api$ phive install --trust-gpg-keys 4AA394086372C20A,12CE0F1D262429A5,31C7E470E2138192,8AC0BAA79732DD42,C5095986493B4AA0

Tests

To run the tests :

user@host resto-api$ ./tools/phpunit -c ./ci/phpunit.xml

The generated outputs will be in ./ci/phpunit/. Look at ./ci/phpunit/html/index.html for code coverage and ./ci/phpunit/testdox.html for a verbose list of passing / failing tests.

To run mutation testing, you must run PHPUnit first, then :

user@host resto-api$ ./tools/infection -c./ci/infection.json

The generated outputs will be in ./ci/infection/.

Static analysis

To do a static analysis :

user@host resto-api$ ./tools/psalm -c ./ci/psalm.xml [--report=./psalm/psalm.txt --output-format=text]

Use "--report=./psalm/psalm.txt --output-format=text" if you want the output in a file instead of on screen.

PHPDoc

To generate the PHPDoc :

user@host resto-api$ ./tools/phpdocumentor --config ./ci/phpdoc.xml

The generated HTML documentation will be in ./ci/phpdoc/.

Standard

All PHP files in this project follows PSR-12. To indent the code :

user@host resto-api$ ./tools/phpcbf --standard=PSR12 --extensions=php --ignore=*/Kernel.php -p ./src/ ./tests/

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages