PHPackages                             cocart-headless/cocart-sniffs - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. cocart-headless/cocart-sniffs

ActivePhpcodesniffer-standard[Testing &amp; Quality](/categories/testing)

cocart-headless/cocart-sniffs
=============================

Collection of PHP\_CodeSniffer sniffs for CoCart development.

1.0.1(3w ago)11.6kMITPHPPHP &gt;=7.4

Since Jul 9Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (13)Versions (5)Used By (0)

CoCart Sniffs
=============

[](#cocart-sniffs)

Collection of PHP\_CodeSniffer sniffs for CoCart projects.

Features
--------

[](#features)

### Code Standards &amp; Linting

[](#code-standards--linting)

- ✅ WordPress Coding Standards 3.3.0
- ✅ PHPCompatibility for WordPress
- ✅ VIP Coding Standards 3.0.1
- ✅ WooCommerce custom sanitization functions
- ✅ Preconfigured rules for CoCart projects
- ✅ Modern PHPCS 4.0 compatible syntax

### Static Analysis

[](#static-analysis)

- ✅ PHPStan 2.0 with WordPress extensions
- ✅ WooCommerce &amp; WP-CLI type stubs

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

[](#installation)

```
composer require --dev cocart-headless/cocart-sniffs
```

Quick Start
-----------

[](#quick-start)

### Option 1: Use Template (Recommended)

[](#option-1-use-template-recommended)

Copy the sample configuration to your project:

```
cp vendor/cocart-headless/cocart-sniffs/phpcs.xml.dist.sample phpcs.xml
```

Then edit `phpcs.xml` and change:

- `your-text-domain` to your project's text domain
- Add/remove exclusion patterns as needed

### Option 2: Minimal Configuration

[](#option-2-minimal-configuration)

Create a `phpcs.xml` file in your project root:

```

	My CoCart project standards

	.
	*/vendor/*

```

Usage
-----

[](#usage)

### Using Composer Scripts (Recommended)

[](#using-composer-scripts-recommended)

This package includes helpful composer scripts:

```
# Code Standards (PHPCS)
composer phpcs         # Check code standards
composer phpcbf        # Auto-fix issues
composer lint          # Alias for phpcs
composer format        # Alias for phpcbf
composer phpcs:ci      # For CI/CD (generates checkstyle XML report)

# Static Analysis (PHPStan)
composer phpstan       # Run static analysis
```

### Direct PHPCS Commands

[](#direct-phpcs-commands)

Check a specific file:

```
vendor/bin/phpcs --standard=CoCart-Core path/to/file.php
```

Check entire project (if you have phpcs.xml):

```
vendor/bin/phpcs
```

Auto-fix issues:

```
vendor/bin/phpcbf
```

What's Included
---------------

[](#whats-included)

### All Development Tools in One Package

[](#all-development-tools-in-one-package)

This package is a comprehensive development toolkit for CoCart projects, including:

**Code Standards:**

- WordPress Coding Standards 3.3.0
- VIP Coding Standards 3.0.1
- PHPCompatibility for WordPress 2.1.6
- PHPCSExtra 1.5.0

**Static Analysis:**

- PHPStan 2.0 for static analysis
- PHPStan WordPress extensions
- WooCommerce stubs for type checking
- WP-CLI stubs for type checking

### CoCart-Core Standard Rules

[](#cocart-core-standard-rules)

The CoCart-Core standard includes:

- **WordPress Coding Standards** with sensible defaults
- **PHPCompatibility** checks for PHP 7.4+
- **WooCommerce functions** recognized as sanitization/escaping functions:
    - `wc_clean`, `wc_sanitize_tooltip`, `wc_format_decimal`
    - `wc_stock_amount`, `wc_sanitize_permalink`, `wc_sanitize_textarea`
    - `wc_help_tip`, `wc_kses_notice`
- **Relaxed rules** for:
    - Non-strict `in_array()` comparisons (common in WordPress)
    - `preg_quote()` without delimiter
    - Underscore-prefixed properties (legacy code)
- **Database query exclusions** for direct queries (common in WooCommerce)

Customization
-------------

[](#customization)

### Add Project-Specific Exclusions

[](#add-project-specific-exclusions)

```

```

### Exclude File Patterns

[](#exclude-file-patterns)

```

	includes/*.php
	includes/third-party/**/*.php

```

### Override Configurations

[](#override-configurations)

```

```

Changelog
---------

[](#changelog)

[See changelog for details](https://github.com/cocart-headless/cocart-sniffs/blob/master/CHANGELOG.md)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance53

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84% 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 ~614 days

Total

4

Last Release

22d ago

Major Versions

0.0.3 → 1.0.12026-07-28

PHP version history (2 changes)0.0.1PHP &gt;=7.0

1.0.1PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8830fe7080250a6d46e47e17fb944578f9e8b4700c0f8c28a78d93b2c8a52723?d=identicon)[seb86](/maintainers/seb86)

---

Top Contributors

[![seb86](https://avatars.githubusercontent.com/u/497406?v=4)](https://github.com/seb86 "seb86 (21 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (3 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (1 commits)")

---

Tags

standardsphpcswordpressstatic analysisCoCart

### Embed Badge

![Health badge](/badges/cocart-headless-cocart-sniffs/health.svg)

```
[![Health](https://phpackages.com/badges/cocart-headless-cocart-sniffs/health.svg)](https://phpackages.com/packages/cocart-headless-cocart-sniffs)
```

###  Alternatives

[wp-cli/wp-cli-tests

WP-CLI testing framework

423.3M150](/packages/wp-cli-wp-cli-tests)[humanmade/coding-standards

Human Made Coding Standards

161450.0k66](/packages/humanmade-coding-standards)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.2M36](/packages/yoast-yoastcs)[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.8k49.8M2.6k](/packages/wp-coding-standards-wpcs)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2023.2M367](/packages/drupal-core-dev)[automattic/vipwpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

25911.8M223](/packages/automattic-vipwpcs)

PHPackages © 2026

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