Outsource Laravel Development Partner - $3200/Month | Bacancy

Php_Codesniffer

Php_Codesniffer stats

Downloads
287.6M
Stars
10,710
Open Issues
289
Forks
1,473

View on GitHub →

PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.

PHP_CodeSniffer Package Summary

Overview

PHP_CodeSniffer is a crucial tool for maintaining code quality and consistency, equipped with two primary scripts: phpcs for tokenizing PHP, JavaScript, and CSS files to detect coding standard violations, and phpcbf for automatically correcting these violations. This package helps ensure that your project adheres to a specified coding standard, enhancing readability and maintainability.

Key Features

  • Tokenization of Multiple Languages: PHP, JavaScript, and CSS.
  • Automatic Code Correction: Utilize phpcbf to automatically fix code standard violations.
  • Compatibility: Requires PHP 5.4.0 or higher, with specific sniffs possibly requiring additional tools.
  • Configurability: Supports custom configuration files for team or CI server integrations.
  • Multiple Installation Methods: Installable via Phar files, Composer, Phive, PEAR, or directly from the Git repository.

Installation

  • Phar Files:
    curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
    curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
    # or via wget
    wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
    wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
  • Composer:
    composer global require "squizlabs/php_codesniffer=*"
  • Phive:
    phive install phpcs
    phive install phpcbf
  • PEAR:
    pear install PHP_CodeSniffer
  • Git Clone:
    git clone https://github.com/squizlabs/PHP_CodeSniffer.git

Usage

Run PHP_CodeSniffer using:

phpcs /path/to/code-directory
phpcbf /path/to/code-directory

Specify coding standards with the --standard option:

phpcs --standard=PSR12 /path/to/code-directory

Documentation and Support

Important Note

This repository has been abandoned. Its successor is PHPCSStandards/PHP_CodeSniffer. For more details, see issue #3932.

PHP_CodeSniffer adheres to semantic versioning with detailed guidelines for each version type (MAJOR, MINOR, PATCH), ensuring consistent and predictable updates.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Squizlabs Php Codesniffer Related Articles

Using PHP Codesniffer With Laravel image

Using PHP Codesniffer With Laravel

Read article
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift