PHPackages                             weerd/php-style - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. weerd/php-style

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

weerd/php-style
===============

Shareable pre-configured base style rules for the PHP Code Standards Fixer tool.

v1.2.0(5y ago)21.1kMITPHPPHP ^7.1|^8.0

Since Aug 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/weerd/php-style)[ Packagist](https://packagist.org/packages/weerd/php-style)[ RSS](/packages/weerd-php-style/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

✨ PHP Styles ✨
==============

[](#-php-styles-)

This package provides a simple way to apply pre-configured base style rules for the [PHP Code Standards Fixer tool](https://cs.symfony.com/), that can be easily shared across projects and packages using PHP 7+.

It can be configured using the `default` rules or you can specify a different supported base ruleset, along with any additional rules or overrides you would like to include.

Installation
------------

[](#installation)

```
$ composer require weerd/php-style

```

Usage
-----

[](#usage)

Add a `.php_cs.dist` in the root directory of your project or pacakge.

Within that file create a new instance of `PhpCsFixer\Finder` and configure what files and directories the PHP CS Fixer tool should be looking to fix code style.

Next, call the `Weerd\PhpStyle\configure()` function and pass the instance of the finder as the first argument.

Below are some examples along with variations utilizing the `$options` array:

### Example using default ruleset

[](#example-using-default-ruleset)

The following example returns a configuration with the [default](https://github.com/weerd/php-style/blob/master/src/rules/default.php) rules for PHP styles.

```
