API

note

📣  All commands have to be run in the api service (make api).

PHP_CodeSniffer#

PHP_CodeSniffer is both a linting and a formatting tool.

The boilerplate adds the rules from the Doctrine Coding Standard.

It will parse your PHP source code, catch common mistakes plus format it.

It's quite strict, but that's for your good! 😁

This command will try to fix and format your source code:

console
composer csfix

This command will verify your source code:

console
composer cscheck

PHPStan#

PHPStan is a static analysis tool that focuses on finding errors in your code without actually running it.

In the boilerplate, we set it to the maximum level.

console
composer phpstan

Deptrac#

Deptrac is a static code analysis tool that enforces rules for dependencies between software layers in your PHP projects.

In other words, il will ensure that:

  • You don't call the classes from the Instrastructure namespace outside of itself.
  • You don't call the classes from the UseCase namespace in the Domain namespace.
console
composer deptrac

YAML configuration#

Symfony provides a linter that checks common errors in YAML files:

console
composer yaml-lint

Composer normalize#

Composer normalize normalizes your composer.json file's structure:

console
COMPOSER_MEMORY_LIMIT=-1 composer normalize