{"id":17446942,"url":"https://github.com/arxeiss/php-coding-standards","last_synced_at":"2026-03-09T15:31:20.991Z","repository":{"id":44550867,"uuid":"229449699","full_name":"arxeiss/php-coding-standards","owner":"arxeiss","description":"Custom ruleset of PHP CodeSniffer sniffs for linting PHP","archived":false,"fork":false,"pushed_at":"2025-12-03T00:43:14.000Z","size":59,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-06T00:55:39.237Z","etag":null,"topics":["custom-ruleset","php-codesniffer","phpcs","phpcs-psr","phpcs-strict","slevomat-rules","squiz"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arxeiss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-21T15:53:35.000Z","updated_at":"2025-12-03T00:42:39.000Z","dependencies_parsed_at":"2024-06-21T12:59:26.928Z","dependency_job_id":"09f3c0ac-4bd7-4958-9e17-ee7650d1438f","html_url":"https://github.com/arxeiss/php-coding-standards","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"f417fd56527085610bb83da4b18904f4c4561aa4"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/arxeiss/php-coding-standards","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxeiss%2Fphp-coding-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxeiss%2Fphp-coding-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxeiss%2Fphp-coding-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxeiss%2Fphp-coding-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arxeiss","download_url":"https://codeload.github.com/arxeiss/php-coding-standards/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxeiss%2Fphp-coding-standards/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30301109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["custom-ruleset","php-codesniffer","phpcs","phpcs-psr","phpcs-strict","slevomat-rules","squiz"],"created_at":"2024-10-17T19:04:45.325Z","updated_at":"2026-03-09T15:31:20.969Z","avatar_url":"https://github.com/arxeiss.png","language":null,"readme":"# PHP CodeSniffer - Custom standard ruleset\n\n[![PHP from Packagist](https://img.shields.io/packagist/php-v/arxeiss/coding-standards)](https://packagist.org/packages/arxeiss/coding-standards)\n[![Packagist Version](https://img.shields.io/packagist/v/arxeiss/coding-standards)](https://packagist.org/packages/arxeiss/coding-standards)\n\nCustom ruleset for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) with [Slevomat sniffs](https://github.com/slevomat/coding-standard). Ruleset is based on **PSR2 + PSR12** with additional rules, more detailed list is below. Ruleset is possible to use with **space indentation** and also **tabs indentation**.\n\n## Installation and running\n\nInstall with composer:\n```bash\ncomposer require --dev arxeiss/coding-standards\n```\n\nand run CodeSniffer\n```bash\n./vendor/bin/phpcs --standard=./vendor/arxeiss/coding-standards/Rules/phpcs-spaces.xml .\n```\n\n### Custom ruleset file\n\nBetter way is to create custom file `phpcs.xml`, with content like *phpcs.example.xml*. After that it is possible to run\n```bash\n./vendor/bin/phpcs --standard=./phpcs.xml\n```\n\n\u003e More info about PHP CodeSniffer can be found in the [PHP CS wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki)\n\n### Groups of sniffs\n\nPackage consist of multiple files based on the used sniffs.\u003cbr\u003e\nThere are 3 files basic files including all selected sniffs. Use *phpcs-spaces.xml* or *phpcs-tabs.xml*, not both. Optionally it is possible to add also *phpcs-strict.xml*.\n\n- **phpcs-spaces.xml** - Contains all sniffs with space indentation\n- **phpcs-tabs.xml** - Contains all sniffs with tabs indentation\n- **phpcs-strict.xml** - Contains extra, more strict rules based on Slevomat rules\n\nIt can be handy to not include all sniffs at once, specially when migrating big project. Files above just including these partial files:\n- **Parts/phpcs-psr.xml** - PSR2 + PSR12 standards\n- **Parts/phpcs-use-spaces.xml** or **Parts/phpcs-use-tabs.xml** - Include only one file on the indentation preferences\n- **Parts/phpcs-generic.xml** - Additional Generic rules\n- **Parts/phpcs-pear.xml** - Additional PEAR rules\n- **Parts/phpcs-squiz.xml** - Additional Squiz rules\n- **Parts/phpcs-slevomat.xml** - Selected Slevomat rules\n\nIf building own ruleset based on partial files, always use *Parts/phpcs-psr.xml*, then *Parts/phpcs-use-spaces.xml* or *Parts/phpcs-use-tabs.xml*.\u003cbr\u003e\nLater more additional rules can be added. See *phpcs.example.xml*.\n\n## Included sniffs\n\nSee [SniffList](SniffsList.md), I wrote one sentence explanation for each used sniff into XML files.\n\nAlso Slevomat rules have some comments about in their repository Readme https://github.com/slevomat/coding-standard\n\n## More suggested\n\n## Check that Namespace matches file structure\nThis is used from my own blog in Laravel, where main folder `app` is `BlogApp` namespace.\n\n```xml\n\u003crule ref=\"SlevomatCodingStandard.Files.TypeNameMatchesFileName\"\u003e\n    \u003cproperties\u003e\n        \u003cproperty name=\"rootNamespaces\" type=\"array\"\u003e\n            \u003celement key=\"app\" value=\"BlogApp\"/\u003e\n        \u003c/property\u003e\n    \u003c/properties\u003e\n\u003c/rule\u003e\n```\n\n## Since v0.11.0 `mixed` typehint is not required\n\nExplanation can be found here https://github.com/arxeiss/php-coding-standards/pull/6\n\nIf you want to force linter to use `mixed` typehint, you can enable by adding this into phpcs.xml file.\n\n```xml\n\u003crule ref=\"SlevomatCodingStandard.TypeHints.ParameterTypeHint\"\u003e \u003c!-- Check correct type hints --\u003e\n    \u003cproperties\u003e\n        \u003cproperty name=\"enableMixedTypeHint\" value=\"true\"/\u003e\n    \u003c/properties\u003e\n\u003c/rule\u003e\n\u003crule ref=\"SlevomatCodingStandard.TypeHints.PropertyTypeHint\"\u003e \u003c!-- Check type hint for class property --\u003e\n    \u003cproperties\u003e\n        \u003cproperty name=\"enableMixedTypeHint\" value=\"true\"/\u003e\n    \u003c/properties\u003e\n\u003c/rule\u003e\n\u003crule ref=\"SlevomatCodingStandard.TypeHints.ReturnTypeHint\"\u003e \u003c!-- Correct return type hint --\u003e\n    \u003cproperties\u003e\n        \u003cproperty name=\"enableMixedTypeHint\" value=\"true\"/\u003e\n    \u003c/properties\u003e\n\u003c/rule\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farxeiss%2Fphp-coding-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farxeiss%2Fphp-coding-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farxeiss%2Fphp-coding-standards/lists"}