diff --git a/README.md b/README.md index 5519d5a..e8099f0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ **Realodix Relax** is built on top of [`PHP-CS-Fixer`][php-cs-fixer] and makes it simple to to sharing identical PHP CS Fixer rules across all of your projects without copy-and-pasting configuration files. + ## Installation You can install this package by using [composer](https://getcomposer.org/): @@ -14,6 +15,7 @@ You can install this package by using [composer](https://getcomposer.org/): composer require --dev realodix/relax ``` + ## Running Relax ```sh @@ -22,6 +24,7 @@ composer require --dev realodix/relax For more details, see PHP-CS-Fixer [documentation](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/usage.rst). + ## Configuring Relax In your PHP CS Fixer configuration file, use the following contents: @@ -74,65 +77,8 @@ By default, Relax will inspect all `.php` files in your project except those in [doc_f_laravel]: docs/finders.md#finderlaravel --> ## Advanced Configuration +See [docs/advanced_configuration.md](docs/advanced_configuration.md) for more details. -You can find the full documentation on this page: -- [PHP-CS-Fixer: Config](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst) -- [PHP-CS-Fixer: Rules](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/index.rst) -- [MLocati: PHP-CS-Fixer Configurator](https://mlocati.github.io/php-cs-fixer-configurator) - - -```php - true, - - // Add rule or override predefined rule - 'visibility_required' => true, - - // Override predefined rule - 'braces' => false, - - // Add custom fixers - 'CustomFixer/rule_1' => true, - 'CustomFixer/rule_2' => true, -]; - -$finder = Finder::create() - ->in(__DIR__) - ->ignoreDotFiles(false) - ->exclude(['Bar']) - ->notName('*.foo.php') - ->append(['.php-cs-fixer.dist.php']); - -return Config::create('laravel') - ->setRules($localRules) - ->setFinder($finder) - ->setRiskyAllowed(false) - ->registerCustomFixers(new \PhpCsFixerCustomFixers\CustomFixer()); -``` - -If you wish to completely define rules locally without using existing rule sets, you can do that: - -```php - true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], -]; - -return Config::create() - ->setRules($localRules); -``` ## Custom Rule Set @@ -170,12 +116,14 @@ use Vendor\Package\MyRuleSet; return Config::create(new MyRuleSet()); ``` + ## Troubleshooting For general help and support join our [GitHub Discussions](../../discussions). Please report bugs to the [GitHub Issue Tracker](../../issues). + ## License This package is licensed under the [MIT License](/LICENSE). diff --git a/docs/advanced_configuration.md b/docs/advanced_configuration.md new file mode 100644 index 0000000..f0bba50 --- /dev/null +++ b/docs/advanced_configuration.md @@ -0,0 +1,60 @@ +## Advanced Configuration + +You can find the full documentation on this page: +- [PHP-CS-Fixer: Config](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst) +- [PHP-CS-Fixer: Rules](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/index.rst) +- [MLocati: PHP-CS-Fixer Configurator](https://mlocati.github.io/php-cs-fixer-configurator) + + +```php + true, + + // Add rule or override predefined rule + 'visibility_required' => true, + + // Override predefined rule + 'braces' => false, + + // Add custom fixers + 'CustomFixer/rule_1' => true, + 'CustomFixer/rule_2' => true, +]; + +$finder = Finder::create() + ->in(__DIR__) + ->ignoreDotFiles(false) + ->exclude(['Bar']) + ->notName('*.foo.php') + ->append(['.php-cs-fixer.dist.php']); + +return Config::create('laravel') + ->setRules($localRules) + ->setFinder($finder) + ->setRiskyAllowed(false) + ->registerCustomFixers(new \PhpCsFixerCustomFixers\CustomFixer()); +``` + +If you wish to completely define rules locally without using existing rule sets, you can do that: + +```php + true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], +]; + +return Config::create() + ->setRules($localRules); +```