Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.
/ demo-rest-api Public archive

Projet de test pour prendre en main PHP 8.0 et gérer les outils de coding quality

License

Notifications You must be signed in to change notification settings

Anthodev/demo-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caker

Caker is a Symfony development stack with the following docker configuration:

  • Caddy v2 as a web server and reverse-proxy
  • A PostgreSQL database
  • A PHP (8.0.*) container based on the thecodingmachine PHP image with these additionnal plugins enabled:
    • pgsql
    • pdo_pgsql
    • intl
    • gd

For the Symfony environment, here is the configuration :

  • PHP 8.0.* (with unlimited PHP memory)
  • Symfony 5.2.*
  • PHPUnit 9.5.*
  • PHPStan (on level 5) with the following packages:
    • extension-installer
    • phpstan-doctrine
    • phpstan-phpunit
    • phpstan-symfony
  • ECS (easy-coding-standard) which include PHPCS and PHP CS Fixer with the following rules:
    • CLEAN_CODE
    • PSR-12
    • DOCTRINE_ANNOTATIONS

Getting started

Before the first run, you must create a .env file at the root of the project (you can copy paste the .env.dist file and rename it) and fill the requested values.

Usage

To launch the stack, you only need to enter the following command in the folder in your terminal:

docker-compose -f ./docker-compose.yml up -d 

To stop it, you can simply run the appropriate command:

docker-compose -f ./docker-compose.yml stop 

Aliases

Several commands have been preconfigured on the PHP container:

  • sf replace php bin/console (the symfony console command)
  • phpunit replace php vendor/bin/simple-phpunit

Check coding standard

As stated above, a full suite of coding standards (CLEAN_CODE, PSR-12, DOCTRINE_ANNOTATIONS) has been configured in the PHP container. To use them you have the following commands:

  • phpstan analyse
  • ecs check to check the coding standards errors
  • ecs check --fix to fix the errors above

Recommended VSCode extensions

This is a list of extensions that works very well with this stack:

Others recommended VSCode extensions

Upcoming

  • Add Github Actions support

About

Projet de test pour prendre en main PHP 8.0 et gérer les outils de coding quality

Resources

License

Stars

Watchers

Forks