PHPackages                             sspooky13/yaml-standards - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. sspooky13/yaml-standards

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

sspooky13/yaml-standards
========================

Standards for yaml files

9.2.1(3mo ago)11518.3k↓11.8%4[11 issues](https://github.com/sspooky13/yaml-standards/issues)[1 PRs](https://github.com/sspooky13/yaml-standards/pulls)3MITPHPPHP ^7.2 || ^8.0CI passing

Since Nov 4Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/sspooky13/yaml-standards)[ Packagist](https://packagist.org/packages/sspooky13/yaml-standards)[ Docs](https://github.com/sspooky13/yaml-standards)[ RSS](/packages/sspooky13-yaml-standards/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (11)Versions (32)Used By (3)

YAML standards
==============

[](#yaml-standards)

[![Total Downloads](https://camo.githubusercontent.com/62ea4005381011d65792fb9d6117aaba9b07da4f0218501f8f32cd57ee6dc4fd/68747470733a2f2f706f7365722e707567782e6f72672f7373706f6f6b7931332f79616d6c2d7374616e64617264732f646f776e6c6f616473)](https://packagist.org/packages/sspooky13/yaml-standards)[![Build Status](https://github.com/sspooky13/yaml-standards/actions/workflows/build.yaml/badge.svg?branch=master)](https://github.com/sspooky13/yaml-standards/actions?query=branch%3Amaster+event%3Apush)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6be6b6cd7c89c3415b506a75e4a581d69d9701f44b8db02730458501af19e50d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7373706f6f6b7931332f79616d6c2d7374616e64617264732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sspooky13/yaml-standards/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/8e1759e9b4a5edd38d5d0484f2c76a21bf038b2d304dcb33efb0cd3a3edc983c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7373706f6f6b7931332f79616d6c2d7374616e64617264732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sspooky13/yaml-standards/?branch=master)[![Quality Gate Status](https://camo.githubusercontent.com/e980f3bcb041fa63ca2f78333edbe8058f6829360d180c6d7a212d50d15cb53e/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7373706f6f6b7931335f79616d6c2d7374616e6461726473266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=sspooky13_yaml-standards)[![PHPStan level](https://camo.githubusercontent.com/0729e562e10fac943b16dbb271b4af26488f779a33fc82cc3eef1e37a432c0b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230352d627269676874677265656e2e737667)](https://camo.githubusercontent.com/0729e562e10fac943b16dbb271b4af26488f779a33fc82cc3eef1e37a432c0b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230352d627269676874677265656e2e737667)

This library is primarily intended to help you to keep observe standards for YAML files, but some standards can be used for other files, e.g. **YamlEmptyLineAtEnd** standard

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

[](#installation)

Install the latest version with [Composer](http://getcomposer.org/) command:

```
composer require --dev sspooky13/yaml-standards

```

Usage
-----

[](#usage)

1. Create config file in project root directory with allowed standards and files/directories to check. You can copy config file `./example/yaml-standards.yaml` and edit it according to your needs.
2. Run `vendor/bin/yaml-standards`

Tips:

- If your config file has different name or it's located in different directory as root you can run command with argument where is wried path to config file with name, e.g. `vendor/bin/yaml-standards ./path/to/your/configFile.yaml`
- You can create target for [Phing](https://www.phing.info/) build tool, e.g.

```

```

Options for run
---------------

[](#options-for-run)

- `./path/to/your/configFile.yaml` Path to your config file. Default is `./yaml-standards.yaml`.
- `--fix` Automatically fix allowed standards problems.
- `--path-to-cache-dir=./path/to/cache/dir/` Custom path where should be cache file stored. Default is the directory PHP stores temporary files in by default ([sys\_get\_temp\_dir()](https://www.php.net/manual/en/function.sys-get-temp-dir.php)).
- `--no-cache` Turn off cache functionality.
- `--no-progress-bar` Turn off progress bar. Useful e.g. for nicer CI output.

Implemented checkers
--------------------

[](#implemented-checkers)

- **YamlAlphabeticalChecker** - Check yaml file is alphabetically sorted to selected level. **This checker has fixer**.
- **YamlIndentChecker** - Check yaml has right count of indents. **This checker has fixer**.
- **YamlSpacesBetweenGroupsChecker** - Check yaml file has empty line between every group to selected level. **This checker has fixer**.
- **YamlInlineChecker** - Check yaml file observe standards by symfony yaml parser.
- **YamlEmptyLineAtEnd** - Check yaml file has empty line at end of file. **This checker has fixer**. Note: This standard can be used on every file, not only yaml files.
- **YamlServiceAliasing** - Check yaml service file observe short or long code style aliasing. **This checker has fixer**.

PHPStorm Integration
--------------------

[](#phpstorm-integration)

You can integrate YAML standards into PHPStorm by using File Watcher.

1. Open Settings -&gt; Tools -&gt; File Watchers
2. Add new -&gt; custom
3. Give it a name
4. Select file type: `YAML`
5. Program: `\vendor\bin\yaml-standards.bat`
6. Arguments: absolute path to your config file
7. In config file path to check and excluded paths must have absolute path too

Now, file watcher check your YAML files by config file and notify you if they have errors

How create your own standards
-----------------------------

[](#how-create-your-own-standards)

1. Create class with your own check/fix logic
2. Checker has to extend class `YamlStandards\Model\AbstractChecker.php` and class name have to end with `Checker` word, e.g. YamlLine**Checker**
3. Fixer has to be in same directory as checker class, extend class `YamlStandards\Model\AbstractFixer.php` and name have to be same as checker class except name must end with `Fixer` word, e.g. YamlLine**Fixer**. **Warning! checker class must exist too.**
4. Both classes must return class `\YamlStandards\Result\Result`
5. Add your checker class with namespace to your config file to `checkers` array
6. done :)

**If you think your checker/fixer can be helpful for others, you can create pull request with your code to make it available to everyone :)**

Exit codes
----------

[](#exit-codes)

Exit code is built using following bit flags:

```
0 OK.
1 Some file has invalid syntax.
2 General error (file is not readable, error with parse yaml file).

```

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance64

Regular maintenance activity

Popularity45

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~107 days

Recently: every ~162 days

Total

29

Last Release

109d ago

Major Versions

4.2.5 → 5.0.02019-12-15

5.1.2 → 6.0.02021-03-21

6.0.0 → 7.0.02021-09-02

7.0.1 → 8.0.02023-02-26

8.1.1 → 9.0.02024-06-04

PHP version history (4 changes)1.0.0PHP ~5.6 || ~7.0

5.0.0PHP ^7.1

7.0.0PHP ^7.1 || ^8.0

9.0.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f3939e828b18aabc1321f21c34828a11ba737734243aaf0284246bff45e5b23?d=identicon)[sspooky13](/maintainers/sspooky13)

---

Top Contributors

[![sspooky13](https://avatars.githubusercontent.com/u/25614491?v=4)](https://github.com/sspooky13 "sspooky13 (359 commits)")[![PetrHeinz](https://avatars.githubusercontent.com/u/10008612?v=4)](https://github.com/PetrHeinz "PetrHeinz (11 commits)")[![boris-brtan](https://avatars.githubusercontent.com/u/39240194?v=4)](https://github.com/boris-brtan "boris-brtan (2 commits)")[![techi602](https://avatars.githubusercontent.com/u/1529526?v=4)](https://github.com/techi602 "techi602 (2 commits)")[![TomasLudvik](https://avatars.githubusercontent.com/u/5638367?v=4)](https://github.com/TomasLudvik "TomasLudvik (2 commits)")[![vasilvestre](https://avatars.githubusercontent.com/u/17164385?v=4)](https://github.com/vasilvestre "vasilvestre (1 commits)")[![ChrisDBrown](https://avatars.githubusercontent.com/u/3877652?v=4)](https://github.com/ChrisDBrown "ChrisDBrown (1 commits)")[![cafferata](https://avatars.githubusercontent.com/u/1150425?v=4)](https://github.com/cafferata "cafferata (1 commits)")

---

Tags

alphabeticalcheckerfixerindentinlinestandardsyamlyaml-filesyaml-standardsstandardsfixeryamlinlineindentcheckeralphabeticalyaml-standardsspace-between-groupsempty-line-at-endservice-aliasing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sspooky13-yaml-standards/health.svg)

```
[![Health](https://phpackages.com/badges/sspooky13-yaml-standards/health.svg)](https://phpackages.com/packages/sspooky13-yaml-standards)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[spatie/yaml-front-matter

A to the point yaml front matter parser

3411.8M68](/packages/spatie-yaml-front-matter)[pragmarx/yaml

Load your Laravel config files using yaml

1152.8M29](/packages/pragmarx-yaml)[dragon-code/codestyler

A tool to automatically fix Coding Style Standards issues by The Dragon Code.

291.8M16](/packages/dragon-code-codestyler)[mhujer/yaml-sort-checker

YAML sort checker checks if your YML files are properly sorted to prevent merge conflicts

2361.6k](/packages/mhujer-yaml-sort-checker)

PHPackages © 2026

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