A very opinionated CS/linting setup for PHP projects.

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 3


1.0.0 2021-08-23 18:14 UTC

This package is auto-updated.

Last update: 2021-12-23 18:49:01 UTC


Getting started

To add the coding standards checkers and linters to your PHP project, follow the instructions below:

  1. Make sure you don't have any uncommited files in your project.
    This package will add files to your project, so you'll likely want to commit all of these all at once.
  2. Add the package to your project with Composer using the command below:
    composer require --dev eckinox/eckinox-cs
    The package will automatically add all of the configuration files and utility scripts you'll need to your project.
  3. Follow any additional instructions provided in the CLI.
  4. Commit the files to your project:
    git add --a && git commit -m "Adds coding standards and linting checks via eckinox/eckinox-cs"
  5. Run the following command to install Javascript dependencies:
    npm install
  6. Enjoy!

What's included

This package is a like a metapackage, but with a little sugar on top.

Not only does it add other PHP dependencies via Composer, but it also:

  • Adds JS dependencies.
  • Creates configuration files.
  • Adds shell scripts to facilitate usage of the tools.
  • Adds a Git pre-commit hook.
  • Adds a Github actions workflow.

Here's a bit of information about all of that.

Tools and packages

Here are the tools that are included and configured in this package:

Tool Config Git-aware
A tool to automatically fix PHP Coding Standards issues
PHP Static Analysis Tool - discover bugs in your code without running it!
PHP Mess Detector
The missing checkstyle for twig!
Find and fix problems in your JavaScript code
.eslintrc.json .eslintignore
CSS stylelint
A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.

The Git-aware column indicates tools whose provided execution script (located in DEV/cs/) will only take into account staged files, instead of running on every file in your project every time.

Configuration files

The packge creates configuration files for every tool it adds.

These configuration files match Eckinox's coding standards, and should not be changed manually.
Changed files could be overwritten in later updates of eckinox/eckinox-cs.

Pre-commit hook for Git

The package includes a pre-commit script that will execute all of the provided tools to check for potential errors and non-standard code.

If you don't have a pre-commit script already, the package will automatically set up this one (as a symbolic link) when you install the package.
If you already have a pre-commit, you will have to merge the two manually.

Github actions workflow

To ensure your project is always respecting the standards, this package adds a workflow for Github Actions that runs every included tool on your codebase.

This allows project members and maintainers to view the status of every branch and pull request, right in Github.