Download the PHP package symplify/easy-coding-standard without Composer
On this page you can find all versions of the php package symplify/easy-coding-standard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download symplify/easy-coding-standard
More information about symplify/easy-coding-standard
Files in symplify/easy-coding-standard
Package easy-coding-standard
Short Description Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer
License MIT
Informations about the package easy-coding-standard
The Easiest way to use Coding Standard
Killer Features
- Install on any PHP 7.2-PHP 8.4 project with any dependencies
- Blazing fast with parallel run out of the box
- Use PHP_CodeSniffer or PHP-CS-Fixer - anything you like
- Use prepared sets and PHP CS Fixer sets to save time
Install
Usage
On the first run, ECS creates ecs.php
config file with directories and first rule to kick off.
Then you can run again to see the suggested diffs:
To actually fix your code, add --fix
:
That's it!
Configure
Most of the time, you'll be happy with the default configuration. The most relevant part is configuring paths, checkers and sets:
Do you want to check all *.php
files in your root (ecs.php
, rector.php
etc.)? Instead of listing them one by one, use ->withRootFiles()
method:
Do you want to include one of 44 sets from php-cs-fixer?
You can:
How to Skip Files/Rules?
Love the sets of rules, but want to skip single rule or some files?
Less Common Options
You probably won't use these, but they can give you more control over the internal process:
Mentioned values are default ones.
Do you use ECS across variety of project? Do you want to run them always the same way in each of those project? Let's make use of Composer scripts
This command adds 2 handy scripts to your composer.json
:
Run them always the same way - to check the code:
To apply fixes, run:
Controlling Output Format
You may want to use ECS to generate reports for third-party tooling.
We currently provide formatters for:
console
: Human-oriented printing à la PHP CS Fixer.json
: A custom JSON blob for arbitrary tooling.junit
: JUnit format to be used in different CI environments.checkstyle
: Useful for Github Action Reports.gitlab
: For Gitlab code quality reports or Code Climate tooling.
For information on how each of these behave, refer to their respective implementations.
FAQ
How do I clear cache?
How can I see all used rules?
Do you look for json format?
Can I Use My .editorconfig
?
Mostly! By using withEditorConfig()
, ECS will automatically discover
the .editorconfig
file in the project's root directory. It will use any
rules under [*]
or [*.php]
(the latter taking priority) and respect the
settings for:
indent_style
end_of_line
max_line_length
trim_trailing_whitespace
insert_final_newline
quote_type
- Only
single
andauto
are respected. - Warning: this is a proposed field, but not fully standard.
- Only
These settings will take precedence over similar rules configured through sets
like PSR12, to avoid conflicting with other tooling using your .editorconfig
.
Unfortunately, not all settings are currently respected, but PRs are always welcome!
How to Migrate from another coding standard tool?
Do you use another tool and want to migrate? It's pretty straightforward - here is "how to":
- for PHP_CodeSniffer
- and PHP CS Fixer.