/spatie-phecks-example

Example repository of a Phecks implementation using Spatie's styleguides

Primary LanguagePHPApache License 2.0Apache-2.0

Spatie Phecks Example

This is an example repository of a Phecks implementation using Spatie's styleguides.

php artisan phecks:run

List of Spatie's style guide

Configuration

Artisan Commands

Routing

  • Public-facing urls must use kebab-case (PublicFacingUrlsMustUseKebabCaseCheck).
  • Prefer to use the route tuple notation when possible.
  • Route names must use camelCase (RouteNamesMustUseCamelCaseCheck).
  • All routes have an HTTP verb, that's why we like to put the verb first when defining a route. It makes a group of routes very readable. Any other route options should come after it.
  • Route parameters should use camelCase (RouteParametersMustUseCamelCaseCheck).
  • A route url should not start with / unless the url would be an empty string.

Controllers

  • Try to keep controllers simple and stick to the default CRUD keywords (index, create, store, show, edit, update, destroy). Extract a new controller if you need other actions. (ControllerMethodsMustStickToCrudCheck).

Views

Validation

  • All custom validation rules must use snake_case

Authorization

  • Policies must use camelCase.

Translations

  • Translations must be rendered with the __ function. We prefer using this over @lang in Blade views because __ can be used in both Blade views and regular PHP code.

Namings: