PHPackages                             locomotivemtl/charcoal-coding-standard - 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. locomotivemtl/charcoal-coding-standard

ActivePhpcodesniffer-standard[Utility &amp; Helpers](/categories/utility)

locomotivemtl/charcoal-coding-standard
======================================

Charcoal Coding Standard

018PHP

Since Dec 4Pushed 5mo ago13 watchersCompare

[ Source](https://github.com/locomotivemtl/charcoal-coding-standard)[ Packagist](https://packagist.org/packages/locomotivemtl/charcoal-coding-standard)[ RSS](/packages/locomotivemtl-charcoal-coding-standard/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Charcoal Coding Standard
========================

[](#charcoal-coding-standard)

[![License](https://camo.githubusercontent.com/7b8befcfaa28a26034fc27b4f61c65f64386e9e3a1dec9ac26a66fa99231dfed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f64696e672d7374616e646172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/locomotivemtl/charcoal-coding-standard)[![Latest Stable Version](https://camo.githubusercontent.com/29e8db5a787db0540f88355ccb610887426dae73895c4abff34f0ba5d3efca9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f64696e672d7374616e646172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/locomotivemtl/charcoal-coding-standard)[![Build Status](https://camo.githubusercontent.com/f26d2d9e6d1e36c5c2abc257c3d4b1f1f85b9b8b4ecacdc0daab97471043e95e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f64696e672d7374616e646172642e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/locomotivemtl/charcoal-coding-standard)

The [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) ruleset to check that repositories are following the standards used by the [Charcoal](https://packagist.org/packages/locomotivemtl/charcoal-app) framework.

Standards
---------

[](#standards)

The Charcoal Coding Standard extends and expands [PSR-1](https://www.php-fig.org/psr/psr-1/) and [PSR-2](https://www.php-fig.org/psr/psr-2/) PSR-12.

For a full reference of enforcements, please consult [`Charcoal/ruleset.xml`](/Charcoal/ruleset.xml).

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

[](#installation)

### 1. Project Installation

[](#1-project-installation)

You can install the Charcoal Coding Standard as a [Composer](https://getcomposer.org/) dependency of your project.

1. Install the package via Composer:

    ```
    $ composer require --dev locomotivemtl/charcoal-coding-standard
    ```
2. Register the new standard with PHP\_CodeSniffer:

    ```
    $ ./vendor/bin/phpcs --config-set installed_paths ./vendor/locomotivemtl/charcoal-coding-standard
    ```

    The second command registers the standard with `phpcs`. Ensure existing values of the `installed_paths` option are not overwritten.
3. Create a `phpcs.xml` file at the base of your repository with the following content:

    ```

    ```

    You can include or exclude sniffs from this file. For a reference of customizations, consult the [PHP\_CodeSniffer annotated ruleset](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml).

    > Note: If you did not register the Charcoal Coding Standard with PHP\_CodeSniffer, you can reference the standard using its path instead of its name:
    >
    > ```
    >
    > ```
    >
    >
    >
    > Example: [`phpcs.xml.example`](/phpcs.xml.example).
4. Add scripts to your `composer.json`:

    ```
    "scripts": {
        "cs-check": "phpcs --colors -p ./src ./tests",
        "cs-fix": "phpcbf --colors ./src ./tests"
    }
    ```

### 2. Global Installation

[](#2-global-installation)

You can also install the Charcoal Coding Standard system-wide:

1. Install the package via Composer:

    ```
    $ composer global require locomotivemtl/charcoal-coding-standard
    ```
2. Register the new standard with PHP\_CodeSniffer:

    ```
    $ phpcs --config-set installed_paths ~/.composer/vendor/locomotivemtl/charcoal-coding-standard
    ```

    The second command registers the standard with `phpcs`. Ensure existing values of the `installed_paths` option are not overwritten.

Usage
-----

[](#usage)

### Sniffing

[](#sniffing)

Depending on how you installed the Charcoal Coding Standard, you can do the following:

Detect violations of this standard with one of:

```
$ phpcs --standard=Charcoal /path/to/some/file/to/sniff.php
$ ./vendor/bin/phpcs --standard=Charcoal /path/to/some/file/to/sniff.php
$ composer cs-check
```

Automatically fix violations of this standard with:

```
$ phpcbf --standard=Charcoal /path/to/some/file/to/sniff.php
$ ./vendor/bin/phpcbf --standard=Charcoal /path/to/some/file/to/sniff.php
$ composer cs-fix
```

For further usage options, see the [CLI documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage).

> Note: If you did not register the Charcoal Coding Standard with PHP\_CodeSniffer, you can reference the standard using its path instead of its name:
>
> ```
> $ ./vendor/bin/phpcs --standard=./vendor/locomotivemtl/charcoal-coding-standard /path/to/code
> ```

### Linting

[](#linting)

The Charcoal Coding Standard provides a simple but convenient bash script wrapper around `php -l` to recursively perform syntax checks on PHP files with several processes at once.

```
Usage:
  phplint [options] []...

Arguments:
  path            One or more paths to files or directories to search for PHP files.
                  Defaults to ./src and ./tests.

Options:
  -h, --help      Display this help message and exit.
  -V, --version   Display version information and exit.

```

Example:

```
$ phplint src/Http/Controllers/ src/Providers/RouteServiceProvider.php
```

> Note: The script is not part of the `composer.json`; it is not added to the given project when the package is installed. The script must be called from the vendor package or you must manually symlink it into your `bin-dir`.
>
> 1. You can run the script from your project:
>
>     ```
>     $ ./vendor/locomotivemtl/charcoal-coding-standard/bin/phplint ./src ./tests
>     ```
> 2. You can also symlink the script into your project's `bin-dir`:
>
>     ```
>     $ cd $(composer config bin-dir)
>     $ ln -s ../locomotivemtl/charcoal-coding-standard/bin/phplint ./phplint
>     ```
>
> Check out [overtrue/phplint](https://packagist.org/packages/overtrue/phplint), a more advanced and configurable tool for linting PHP files.

Credits
-------

[](#credits)

- Chauncey McAskill
- Mathieu Ducharme

License
-------

[](#license)

Charcoal is licensed under the MIT license. See [LICENSE](/LICENSE) for details.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance49

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a4f39523b4b2837562ba0848a0327b8d340118d1ba87cb0f5d59b1d5cb6beba?d=identicon)[mcaskill](/maintainers/mcaskill)

---

Top Contributors

[![mcaskill](https://avatars.githubusercontent.com/u/29353?v=4)](https://github.com/mcaskill "mcaskill (7 commits)")[![JoelAlphonso](https://avatars.githubusercontent.com/u/10762266?v=4)](https://github.com/JoelAlphonso "JoelAlphonso (1 commits)")

### Embed Badge

![Health badge](/badges/locomotivemtl-charcoal-coding-standard/health.svg)

```
[![Health](https://phpackages.com/badges/locomotivemtl-charcoal-coding-standard/health.svg)](https://phpackages.com/packages/locomotivemtl-charcoal-coding-standard)
```

###  Alternatives

[chenkby/yii2-region

Yii2中国省市区三级联动

325.1k](/packages/chenkby-yii2-region)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
