PHPackages                             hyva-themes/hyva-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. [Testing &amp; Quality](/categories/testing)
4. /
5. hyva-themes/hyva-coding-standard

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

hyva-themes/hyva-coding-standard
================================

A set of Hyvä specific PHP CodeSniffer rules extending the Magento Coding Standard

1.0.11(3w ago)2927.5k↓24.4%5OSL-3.0PHPPHP &gt;=8.0

Since Jul 7Pushed 3w ago2 watchersCompare

[ Source](https://github.com/hyva-themes/hyva-coding-standard)[ Packagist](https://packagist.org/packages/hyva-themes/hyva-coding-standard)[ RSS](/packages/hyva-themes-hyva-coding-standard/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (9)Versions (13)Used By (0)

Hyva-Themes PHP\_CodeSniffer ruleset
====================================

[](#hyva-themes-php_codesniffer-ruleset)

A set of Hyvä specific PHP CodeSniffer rules extending the Magento Coding Standard.

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

[](#installation)

We NOT recommend installing the hyva-coding-standard as a dev dependency of the Magento project, because it shares some dependencies with Magento, which can easily lead to composer version conflicts. Instead, we recommend a stand-alone installation of the hyva-coding-standard.

### Stand-alone installation

[](#stand-alone-installation)

Run the following command to install the coding standard stand-alone in a directory `hyva-coding-standard`. You can do this inside or outside the Magento project folder. If you want to set up PHPStorm inspections and are using a remote PHP interpreter (e.g. warden), you will have to install the coding standard inside the Magento project (see below for details). Otherwise we recommend doing this outside of your Magento project folder so it doesn't interfere with the project structure.

```
composer create-project --no-plugins --no-dev hyva-themes/hyva-coding-standard hyva-coding-standard
```

This is also the recommended approach for checking the coding standard in a CI pipeline.

### Installation as a dev dependency of the project

[](#installation-as-a-dev-dependency-of-the-project)

Installing the hyva-coding-standard as a project dependency is not recommended. Instead, consider installing it as stand-alone as described above. If you still want to go ahead, because you are sure the dependencies shared with Magento have compatible versions, run the following commands:

```
composer require --dev hyva-themes/hyva-coding-standard
./vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/Magento2,../../magento/php-compatibility-fork,../../phpcsstandards/phpcsutils,../../hyva-themes/hyva-coding-standard/src
```

Command-Line Usage
------------------

[](#command-line-usage)

Independently of how you installed the hyva-coding-standard, you can check your code by running `vendor/bin/phpcs` within the folder you installed it in.

For example, if you have a stand-alone installation of the hyva-coding-standard inside your home directory within a folder `hyva-coding-standard`, execute

```
~/hyva-coding-standard/vendor/bin/phpcs --standard=HyvaThemes app/code/path/to/check
```

If you installed it as a Magento project dependency, adjust the path to `phpcs` accordingly:

```
./vendor/bin/phpcs --standard=HyvaThemes app/code/path/to/check
```

Usage with Docker (no local PHP required)
-----------------------------------------

[](#usage-with-docker-no-local-php-required)

If you don't have (or don't want) a PHP interpreter on your host system, you can run the coding standard in a Docker container instead. This repository ships a `Dockerfile` and a wrapper script `bin/phpcs-docker` for this purpose.

Clone this repository, and optionally make the wrapper available on your `PATH`, for example:

```
git clone https://github.com/hyva-themes/hyva-coding-standard.git ~/hyva-coding-standard
ln -s ~/hyva-coding-standard/bin/phpcs-docker ~/bin/phpcs-docker
ln -s ~/hyva-coding-standard/bin/phpcbf-docker ~/bin/phpcbf-docker
```

Then run it from the root directory of the project you want to check, passing only the additional `phpcs` arguments — `--standard=HyvaThemes` is applied automatically:

```
cd /path/to/magento-project
phpcs-docker app/code/path/to/check
```

On the first run, the wrapper automatically builds the Docker image (named `hyva-themes/coding-standard` by default, override with the `HYVA_PHPCS_IMAGE` environment variable). The wrapper mounts the current working directory into the container at the same path, so the report output shows your real file paths, and the sniffs can detect the project's PHP version (from `composer.json`) and theme type (from `registration.php`). For this detection to work, always run the command from the project root (or any directory containing the files to check together with the project's `composer.json` further up the tree). Alternatively, set the `HYVA_PHPCS_MOUNT` environment variable to a parent directory (e.g. the project root or your workspace directory) to make it visible inside the container even when running from a subdirectory:

```
cd app/design/frontend/My/theme
HYVA_PHPCS_MOUNT=/path/to/magento-project phpcs-docker Magento_Theme/templates
```

### Rebuilding the image after changes

[](#rebuilding-the-image-after-changes)

The wrapper hashes the files the image is built from (`Dockerfile`, `composer.json`, `bin/`, `src/`) and stores the hash as an image label. When any of those files change (e.g. after a `git pull` or while developing a sniff), the image is rebuilt automatically on the next run — no manual step needed.

One exception: new releases of the *dependencies* (e.g. the Magento coding standard) are not detected, because the dependency versions are resolved inside the image build. To refresh the dependencies to the latest matching releases, rebuild without the Docker layer cache:

```
docker build --no-cache -t hyva-themes/coding-standard ~/hyva-coding-standard
```

(On the next run the wrapper rebuilds once more to re-add its hash label — that rebuild reuses the now-refreshed layer cache, so the updated dependencies are kept.)

### Running phpcbf with Docker

[](#running-phpcbf-with-docker)

To automatically fix violations, use the `bin/phpcbf-docker` wrapper the same way as `bin/phpcs-docker`:

```
cd /path/to/magento-project
phpcbf-docker app/code/path/to/fix
```

Configuration in PHPStorm
-------------------------

[](#configuration-in-phpstorm)

Setting up the PHPStorm configuration differs depending on if you use a containerized or local PHP interpreter. The dialog details also depend on the PHPStorm version. These instructions are based on PHPStorm 2022.1.3.

### PHPStorm setup with a local PHP Interpreter

[](#phpstorm-setup-with-a-local-php-interpreter)

1. In the settings under PHP, ensure a local PHP interpreter is configured.
2. Under "PHP &gt; Quality Tools", select PHP\_CodeSniffer
3. Select the "Local" configuration in the dropdown
4. Click the button with the three dots beside the dropdown
5. Enter the absolute path to `vendor/bin/phpcs` and `vendor/bin/phpcbf` within your stand-alone installation folder, (for example, in my case that is `/Users/vinai/hyva-coding-standard/vendor/bin/phpcs`).
6. Click the "Validate" button, then close the dialog with "OK" if everything is configured correctly.
7. In the PHPStorm settings, navigate to "Editor &gt; Inspections &gt; PHP &gt; Quality Tools"
8. Select "PHP\_CodeSniffer validation"
9. Ensure the file name extension input contains "php,phtml,xml"
10. In the "Coding Standard" dropdown, select "Custom"
11. Click the button with the three dots beside the dropdown
12. Enter the absolute path to the HyvaThemes ruleset in your stand-alone installation (for example, in my case that is `/Users/vinai/hyva-coding-standard/src/HyvaThemes`).
13. Click "OK" to apply the path to the coding standard, and click "OK" again to close the settings dialog.

### With PHP in docker (e.g. warden)

[](#with-php-in-docker-eg-warden)

When using a container based PHP dev environment (for example [warden](https://warden.dev/)), PHPStorm is usually configured to run a "remote" PHP interpreter inside the container. In this case the PHPStorm code sniffer integration is only able to work with a coding standard installation *inside* of the project folder structure. This is a limitation of PHPStorm.

This means, you will have to install the `hyva-coding-standard` stand alone inside the Magento base directory. You probably want to configure it as an excluded directory in PHPStorm, so it isn't indexed. For example, in case of warden, the commands to create a stand-alone installation of the coding standard inside of the project director look like this:

```
warden shell
composer create-project --no-plugins --no-dev hyva-themes/hyva-coding-standard hyva-coding-standard
```

Then configure PHPStorm to use the coding standard using the file system paths inside the container:

1. In the settings under PHP, ensure a remote PHP interpreter is configured for the container.
2. Under "PHP &gt; Quality Tools", select PHP\_CodeSniffer
3. Select the correct remote configuration in the dropdown (e.g. "Interpreter: php-fpm" in case or warden).
4. Click the button with the three dots beside the dropdon
5. Enter the absolute path to `vendor/bin/phpcs` and `vendor/bin/phpcbf` within your stand-alone installation folder, (for example, in case of warden that is `/var/www/html/hyva-coding-standard/vendor/bin/phpcs`).
6. Click the "Validate" button, then close the dialog with "OK" if everything is configured correctly.
7. In the PHPStorm settings, navigate to "Editor &gt; Inspections &gt; PHP &gt; Quality Tools"
8. Select "PHP\_CodeSniffer validation"
9. Ensure the file name extension input contains "php,phtml,xml"
10. In the "Coding Standard" dropdown, select "Custom"
11. Click the button with the three dots beside the dropdown
12. Enter the absolute path to the HyvaThemes ruleset in your stand-alone installation (for example, in my case that is `/var/www/html/hyva-coding-standard/src/HyvaThemes`).
13. Click "OK" to apply the path to the coding standard, and click "OK" again to close the settings dialog.

### License

[](#license)

This package is licensed under the **Open Software License (OSL 3.0)**.

- **Copyright:** Copyright © 2020-present Hyvä Themes. All rights reserved.
- **License Text (OSL 3.0):** The full text of the OSL 3.0 license can be found in the `LICENSE.txt` file within this package, and is also available online at .

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance95

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 93.1% 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 ~130 days

Recently: every ~15 days

Total

12

Last Release

25d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.3

1.0.3PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1905417db5fbd31a61553b29bd441fdc66945da7cfb14f1b20a72275c68184e8?d=identicon)[vinai](/maintainers/vinai)

![](https://www.gravatar.com/avatar/7cd0062c670f61aa554c5d30193848ac11031b6cdb8f8616249b95a235eb475d?d=identicon)[wigman](/maintainers/wigman)

---

Top Contributors

[![Vinai](https://avatars.githubusercontent.com/u/72463?v=4)](https://github.com/Vinai "Vinai (27 commits)")[![JeroenBoersma](https://avatars.githubusercontent.com/u/1163348?v=4)](https://github.com/JeroenBoersma "JeroenBoersma (1 commits)")[![rodrigoprimo](https://avatars.githubusercontent.com/u/77215?v=4)](https://github.com/rodrigoprimo "rodrigoprimo (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hyva-themes-hyva-coding-standard/health.svg)

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

###  Alternatives

[slevomat/coding-standard

Slevomat Coding Standard for PHP\_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

1.5k134.0M2.3k](/packages/slevomat-coding-standard)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M44](/packages/dereuromark-cakephp-ide-helper)[acquia/coding-standards

PHP\_CodeSniffer rules (sniffs) for Acquia coding standards

225.0M35](/packages/acquia-coding-standards)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13191.0k8](/packages/youwe-testing-suite)

PHPackages © 2026

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