Skip to content

jroman00/php-coding-standards

Repository files navigation

jroman00/php-coding-standards

This project makes custom PHP code sniffs available to your project

Table of Contents

Getting Started

These instructions will allow you to import this project's sniffs into your own project

Prerequisites

Install PHP_CodeSniffer

composer require --dev squizlabs/phpcs

For more information, see https://github.com/squizlabs/PHP_CodeSniffer/

Installation

1. Add a Custom VCS

In your composer.json file, add https://github.com/jroman00/php-coding-standards.git as a custom VCS:

"repositories": [{
    "type": "vcs",
    "url": "https://github.com/jroman00/php-coding-standards.git"
}],

2. Require this Library

Import this project via composer, by running the following:

composer require --dev jroman00/php-coding-standards

3. Define a Custom Ruleset.xml

In your ruleset.xml, add the following:

  1. An entry for installed_paths for this library
  2. A rule for this library
<?xml version="1.0"?>
<ruleset>
    <description>Coding standards</description>

    <!-- jroman00/php-coding-standards -->
    <config name="installed_paths" value="vendor/jroman00/php-coding-standards" />

    <!-- Jroman00 -->
    <rule ref="Jroman00" />

    <!-- Additional configs can go here -->
    <!-- ... -->
</ruleset>

For more information, see PHP_CodeSniffer's Annotated ruleset.xml

4. Lint Your Code

./vendor/bin/phpcs -p --standard=./ruleset.xml src/

Contributing

When contributing to this repository, please first discuss the change you wish to make via an issue, an email, or any other method with the owners of this repository before making a change

Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md for more details

About

This project makes custom PHP code sniffs available to your project

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Packages