dragon-code / codestyler
A tool to automatically fix Coding Style Standards issues by The Dragon Code.
Installs: 1 486 998
Dependents: 2
Suggesters: 0
Security: 0
Stars: 30
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^8.2
- ergebnis/composer-normalize: ^2.47
- laravel/pint: ^1.24
- dev-main
- 6.x-dev
- 6.0.0
- 5.x-dev
- 5.5.2
- 5.5.1
- 5.5.0
- 5.4.0
- 5.3.0
- 5.2.0
- 5.1.0
- 5.0.0
- 4.x-dev
- 4.3.1
- 4.3.0
- 4.2.0
- 4.1.0
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- v4
- 3.x-dev
- v3.15.1
- 3.15.0
- v3.14.1
- 3.14.0
- 3.13.0
- v3.12.2
- v3.12.1
- 3.12.0
- 3.11.0
- v3.10.1
- v3.10.0
- v3.9.0
- v3.8.1
- v3.8.0
- v3.7.2
- v3.7.1
- v3.7.0
- v3.6.18
- v3.6.17
- v3.6.16
- v3.6.15
- v3.6.14
- v3.6.13
- v3.6.12
- v3.6.11
- v3.6.8
- v3.6.7
- v3.6.6
- v3.6.5
- v3.6.4
- v3.6.3
- v3.6.2
- v3.6.1
- v3.6.0
- v3.5.1
- v3.5.0
- v3.4.3
- v3.4.2
- v3.4.1
- v3.4.0
- v3.3.4
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- 2.x-dev
- v2.6.24
- v2.6.23
- v2.6.22
- v2.6.21
- v2.6.20
- v2.6.19
- v2.6.18
- v2.6.17
- v2.6.16
- v2.6.15
- v2.6.14
- v2.6.13
- v2.6.12
- v2.6.11
- v2.6.10
- v2.6.9
- v2.6.8
- v2.6.7
- v2.6.6
- v2.6.5
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.x-dev
- v1.13.1
- v1.13.0
- v1.12.4
- v1.12.3
- v1.12.2
- v1.12.1
- v1.12.0
- 1.12-rc.1
- v1.11.1
- v1.11.0
- v1.10.8
- v1.10.7
- v1.10.6
- v1.10.5
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.0
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.0
- v1.6.2
- v1.6.1
- v1.6.0
- dev-6x
This package is auto-updated.
Last update: 2025-07-12 11:05:24 UTC
README
Note
Codestyler 5
is the last version that runs on its own code and includes a mechanism for publishing files via command
parameters. It is also the last version installed globally via Composer.
Starting with Codestyler 6
, the project will contain pint.json
and .editorconfig
files, and adding them to the
project will be done by calling a console command.
Installation
You can install the package using Composer:
composer require dragon-code/codestyler --dev
composer config scripts.style "vendor/bin/pint --parallel"
After installing the dependency, add a file copy command to the scripts.post-update-cmd
section.
This will automatically copy the pint.json
file to the project root.
When adding the command, replace 8.4
with the minimum PHP version your application works with.
Available presets: 8.2
, 8.3
and 8.4
.
You can also add copying the .editorconfig
file to help the IDE and calling normalize the composer.json
file:
{ "scripts": { "post-update-cmd": [ "cp vendor/dragon-code/codestyler/presets/pint/8.4.json pint.json", "cp vendor/dragon-code/codestyler/.editorconfig .editorconfig", "composer normalize" ] } }
Usage
Linter
Laravel Pint
is used as the linker. Documentation for working with it can be
found here.
The linter is invoked by a console command:
composer style
EditorConfig
The .editorconfig
file helps your IDE to work according to certain rules.
To do this, make sure the file is in the root of the project.
You can also automate this process by adding a call to the file copy function in the scripts.post-update-cmd
section of the composer.json
file.
{ "scripts": { "post-update-cmd": [ "cp vendor/dragon-code/codestyler/.editorconfig .editorconfig" ] } }
Composer Normalize
We recommend using the Composer Normalize plugin,
which normalizes the composer.json
file appearance to match its schema.
This will keep each project's file consistent, making it much easier to read.
To activate the plugin, call the console command:
composer config allow-plugins.ergebnis/composer-normalize true
To use this feature, add a call parameter to the post-update-cmd
block of the composer.json
file:
{ "scripts": { "post-update-cmd": [ "composer normalize" ] } }
Now you can just a run console command:
composer update
Finalized composer.json
After completing all the steps, the composer.json
file will have the following changes:
{ "require-dev": { "dragon-code/codestyler": "^6.0" }, "config": { "allow-plugins": { "ergebnis/composer-normalize": true } }, "scripts": { "post-update-cmd": [ "cp vendor/dragon-code/codestyler/presets/pint/8.4.json pint.json", "cp vendor/dragon-code/codestyler/.editorconfig .editorconfig", "composer normalize" ], "style": "vendor/bin/pint --parallel" } }
IDE
After executing the composer update
console command, a .editorconfig
file will be added to your application.
If the file already exists, it will be replaced.
In order for your IDE to read the code style settings from it, make sure its support is enabled in the settings.
For example, in phpStorm
the setting is in
the File | Settings | Editor | Code Style:
License
This package is licensed under the MIT License.