PHPackages                             w4msolutions/php-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. w4msolutions/php-standard

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

w4msolutions/php-standard
=========================

Custom W4M PHP standards

2.0.2(3mo ago)078↓50%[1 PRs](https://github.com/W4MSOLUTIONS/php-standard/pulls)proprietaryPHP &gt;=7.4

Since Mar 27Pushed 2mo agoCompare

[ Source](https://github.com/W4MSOLUTIONS/php-standard)[ Packagist](https://packagist.org/packages/w4msolutions/php-standard)[ RSS](/packages/w4msolutions-php-standard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (12)Used By (0)

W4M PHP Standards
=================

[](#w4m-php-standards)

This is the W4M PHP Standards customized PHP standards based on the PSR-2 PHP Standard.

**It is for W4M Internal use only!**

> For using with PHP &lt; 8 use versions 1.x.x

TO COVER
--------

[](#to-cover)

- Multiple blank lines - one line at most

Usage
-----

[](#usage)

Check with PHP\_CodeSniffer against this standard

Add the W4M PHP Standards to your PHP project using composer

**1.** Install this standard

w4msolutions/php-standard will install [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) as a dependency (squizlabs/php\_codesniffer)

```
composer require --dev w4msolutions/php-standard
```

After install, `composer.json` should look like:

> For using with PHP &lt; 8 use versions 1.x.x

```
{
    "name": "w4msolutions/MyProject",
    "version": "1.0",
    "description": "MyProject Description",
    "keywords": ["MyProject", "framework", "xxxxx", "xxxxxxxx"],
    "homepage": "https://w4msolutions.com/",
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "require": {
    },
    "require-dev": {
        "w4msolutions/php-standard": "^2"
    }
}
```

**2.** Add `phpcs.xml` file to the root of the project

`phpcs.xml` will be used to specify which standard to use with PHP\_CodeSniffer, adjust some sniffs and adapt to current project.

You can find `vendor/w4msolutions/php-standard/phpcs-dist-project.xml` inside the `w4msolutions/php-standards` package that can be used as a base when creating `phpcs.xml` for your project.

**3.** Check code

From the root of your project execute PHP\_CodeSniffer (phpcs)

php\_codesniffer should be installed for your project (not global) so you have to use full path to executable

```
# Check a file
./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=./phpcs.xml myFile.php

# Check a folder
./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=./phpcs.xml path/to/folder/

# Check whole project
./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=./phpcs.xml .
```

Example output:

```
./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcs.xml /app/api/index.php

E 1 / 1 (100%)

FILE: api/index.php
--------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------
  1 | WARNING | [ ] A file should declare new symbols (classes, functions, constants, etc.) and
    |         |     cause no other side effects, or it should execute logic with side effects,
    |         |     but should not do both. The first symbol is defined on line 9 and the first
    |         |     side effect is on line 4. (PSR1.Files.SideEffects.FoundWithSymbols)
  9 | ERROR   | [x] No space found after comma in function call
    |         |     (Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma)
 11 | ERROR   | [x] No space found after comma in function call
    |         |     (Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma)
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

Time: 480ms; Memory: 5.25Mb
```

> Correcting marked errors should be safe but **ALWAYS CHECK THE FILES** after automatic fixing.

Correct the files manually or automatically and execute again.
There should be **NO ERRORS** and the LEAST AMOUNT OF WARNINGS as possible.

**4.** (EXPERIMENTAL AND OPTIONAL) Automatically correct the code

From the root of your project execute PHP Code Beautifier and Fixer (`phpcbf`)

PHP Code Beautifier and Fixer (`phpcbf`) will fix some errors - It will not fix warnings

```
# Check a file
./vendor/squizlabs/php_codesniffer/bin/phpcbf --standard=./phpcs.xml myFile.php

# Check a folder
./vendor/squizlabs/php_codesniffer/bin/phpcbf --standard=./phpcs.xml path/to/folder/

# Check whole project
./vendor/squizlabs/php_codesniffer/bin/phpcbf --standard=./phpcs.xml .
```

Example output:

```
./vendor/squizlabs/php_codesniffer/bin/phpcbf --standard=phpcs.xml /app/api/index.php

F 1 / 1 (100%)

PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE                                                  FIXED  REMAINING
----------------------------------------------------------------------
api/index.php                                         2      1
----------------------------------------------------------------------
A TOTAL OF 2 ERRORS WERE FIXED IN 1 FILE
----------------------------------------------------------------------

Time: 538ms; Memory: 5.5Mb
```

Running php\_codesniffer again will show any existing errors and warnings.

**Repeat process until there are no errors or warnings.**

Example output:

```
./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcs.xml /app/api/index.php

W 1 / 1 (100%)

FILE: api/index.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 1 | WARNING | A file should declare new symbols (classes, functions, constants,
   |         | etc.) and cause no other side effects, or it should execute logic
   |         | with side effects, but should not do both. The first symbol is
   |         | defined on line 9 and the first side effect is on line 4.
   |         | (PSR1.Files.SideEffects.FoundWithSymbols)
-------------------------------------------------------------------------------------

Time: 518ms; Memory: 5.25Mb
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance82

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~78 days

Total

8

Last Release

105d ago

Major Versions

1.2.0 → 2.0.02025-03-28

1.2.3 → 2.0.12026-02-02

PHP version history (6 changes)1.2.0PHP &gt;=5.6

2.0.0PHP &gt;8.1

1.2.1PHP &gt;=5.6, &lt;=8.1

1.2.3PHP &gt;=5.6, &lt;=8.0

2.0.2PHP &gt;=7.4

1.2.4PHP &gt;=5.6, &lt;7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/170144652?v=4)[W4MSOLUTIONS](/maintainers/W4MSOLUTIONS)[@W4MSOLUTIONS](https://github.com/W4MSOLUTIONS)

---

Top Contributors

[![w4m-nelsondias](https://avatars.githubusercontent.com/u/150206383?v=4)](https://github.com/w4m-nelsondias "w4m-nelsondias (6 commits)")

### Embed Badge

![Health badge](/badges/w4msolutions-php-standard/health.svg)

```
[![Health](https://phpackages.com/badges/w4msolutions-php-standard/health.svg)](https://phpackages.com/packages/w4msolutions-php-standard)
```

###  Alternatives

[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)[mayflower/mo4-coding-standard

PHP CodeSniffer ruleset implementing the MO4 coding standards extending the Symfony coding standards.

17508.3k5](/packages/mayflower-mo4-coding-standard)[orisai/coding-standard

Strict PHP coding standard

19193.5k62](/packages/orisai-coding-standard)

PHPackages © 2026

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