eckinox/eckinox-cs
Eckinox CS adds linting and coding standards to PHP projects. Installs and configures PHP-CS-Fixer, PHPStan, PHPMD and more, plus JS deps, config files, helper scripts, a git pre-commit hook, and a GitHub Actions workflow.
To add the coding standards checkers and linters to your PHP project, follow the instructions 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.npm install
chmod +x DEV/**/*
git add --a && git commit -m "Adds coding standards and linting checks via eckinox/eckinox-cs"
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:
Here's a bit of information about all of that.
Here are the tools that are included and configured in this package:
| Tool | Config | Git-aware |
|---|---|---|
| EditorConfigHelps maintain consistent coding styles across various editors and IDEs. | .editorconfig |
N/A |
| PHP-CS-FixerA tool to automatically fix PHP Coding Standards issues | .php_cs.dist |
✅ |
| PHPStanPHP Static Analysis Tool - discover bugs in your code without running it! | phpstan.neon |
✅ |
| PHPMDPHP Mess Detector | .phpmd.xml |
✅ |
| Twig-CS-FixerThe missing checkstyle for twig! | .twig-cs-fixer.dist.php |
❌ |
| ESLintFind and fix problems in your JavaScript code | .eslintrc.json .eslintignore |
❌ |
| CSS stylelintA mighty, modern linter that helps you avoid errors and enforce conventions in your styles. | .stylelintrc.json |
❌ |
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.
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.
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.
Another pre-commit script ( pre-commit-with-bypass ) is available if you need to be able to commit when somes test fail. After each tool if some test fail, the script will ak if you want to continue. The script need to be installed manually.
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.
If you are using private Github repositories via Composer, set up the secrets for HTTP authentication as described in php-actions/composer's documentation.
The workflow included by eckinox-cs already includes the steps necessary to retrieve and use that authentication token, if it is present.
How can I help you explore Laravel packages today?