https://github.com/phlak/codingstandards
A pre-defined set of coding standards for PHP CS Fixer.
https://github.com/phlak/codingstandards
coding-standards php php-cs-fixer
Last synced: 8 months ago
JSON representation
A pre-defined set of coding standards for PHP CS Fixer.
- Host: GitHub
- URL: https://github.com/phlak/codingstandards
- Owner: PHLAK
- License: mit
- Created: 2020-08-21T03:52:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-11T19:36:56.000Z (over 1 year ago)
- Last Synced: 2025-04-12T18:12:20.480Z (about 1 year ago)
- Topics: coding-standards, php, php-cs-fixer
- Language: PHP
- Homepage: https://packagist.org/packages/phlak/coding-standards
- Size: 85.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
PHLAK's Coding Standards
========================
A pre-defined set of coding standards for PHP CS Fixer
Created by Chris Kankiewicz (@phlak.dev)
---
Requirements
------------
- PHP >= 8.1
Installation
------------
composer require --dev phlak/coding-standards
Usage
-----
After installation you may initialze the coding standards configuration with the provided `cs` executable.
composer exec cs init
Alternatively you may manually create a `.php-cs-fxer.dist.php` file in the root folder with the following contents.
```php
in([
// List of paths you wish to include
]);
return PHLAK\CodingStandards\ConfigFactory::make($finder);
```
Add the paths you wish to be coverd to the array.
Now you may run `php-cs-fixer` as normal.
#### Add / Override Rules
You can add additional rules or override pre-defined ones by passing them as the second parameter to the `ConfigFactory::make()` method. These rules will be merged with the pre-defined rules.
```php
return PHLAK\CodingStandards\ConfigFactory::make($finder, [
// Your additional rules here...
]);
```
#### Additional Configuration
Additional configuration can be achieved by chaining methods onto the `ConfigFactory::make()` method.
```php
return PHLAK\CodingStandards\ConfigFactory::make($finder)
->setIndent("\t")
->setLineEnding("\r\n")
->setRiskyAllowed();
```
Changelog
---------
A list of changes can be found on the [GitHub Releases](https://github.com/PHLAK/CodingStandards/releases) page.
Troubleshooting
---------------
For general help and support join our [GitHub Discussions](https://github.com/PHLAK/CodingStandards/discussions) or reach out on [Bluesky](https://bsky.app/profile/phlak.dev).
Please report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/CodingStandards/issues).
Copyright
---------
This project is licensed under the [MIT License](https://github.com/PHLAK/CodingStandards/blob/master/LICENSE).