{"id":28495723,"url":"https://github.com/laminas/laminas-coding-standard","last_synced_at":"2025-07-02T10:30:53.215Z","repository":{"id":36940382,"uuid":"231147264","full_name":"laminas/laminas-coding-standard","owner":"laminas","description":"The coding standard ruleset for Laminas components.","archived":false,"fork":false,"pushed_at":"2025-05-26T10:13:25.000Z","size":1355,"stargazers_count":32,"open_issues_count":5,"forks_count":17,"subscribers_count":17,"default_branch":"3.2.x","last_synced_at":"2025-06-08T11:44:48.901Z","etag":null,"topics":["coding-standards"],"latest_commit_sha":null,"homepage":"https://docs.laminas.dev/laminas-coding-standard/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laminas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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},"funding":{"community_bridge":"laminas-project"}},"created_at":"2019-12-31T21:16:46.000Z","updated_at":"2025-05-26T10:13:28.000Z","dependencies_parsed_at":"2024-06-18T12:27:29.063Z","dependency_job_id":"4a8c1fbe-2c94-4e8e-80a3-82d298cd222e","html_url":"https://github.com/laminas/laminas-coding-standard","commit_stats":{"total_commits":220,"total_committers":21,"mean_commits":"10.476190476190476","dds":0.6954545454545454,"last_synced_commit":"c1aaa18a7c860c6932677a3e4ec13161f9fc7d61"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/laminas/laminas-coding-standard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laminas%2Flaminas-coding-standard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laminas%2Flaminas-coding-standard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laminas%2Flaminas-coding-standard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laminas%2Flaminas-coding-standard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laminas","download_url":"https://codeload.github.com/laminas/laminas-coding-standard/tar.gz/refs/heads/3.2.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laminas%2Flaminas-coding-standard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263120577,"owners_count":23416845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["coding-standards"],"created_at":"2025-06-08T11:31:11.913Z","updated_at":"2025-07-02T10:30:53.193Z","avatar_url":"https://github.com/laminas.png","language":"PHP","funding_links":["https://funding.communitybridge.org/projects/laminas-project"],"categories":["Framework specific"],"sub_categories":[],"readme":"# laminas-coding-standard\n\n[![Build Status](https://github.com/laminas/laminas-coding-standard/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/laminas/laminas-coding-standard/actions/workflows/continuous-integration.yml)\n\n\u003e ## 🇷🇺 Русским гражданам\n\u003e\n\u003e Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.\n\u003e\n\u003e У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.\n\u003e\n\u003e Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите \"Нет войне!\"\n\u003e\n\u003e ## 🇺🇸 To Citizens of Russia\n\u003e\n\u003e We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.\n\u003e\n\u003e One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.\n\u003e\n\u003e You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say \"stop the war!\"\n\nThe coding standard ruleset for Laminas components.\n\nThis specification extends and expands [PSR-12](https://www.php-fig.org/psr/psr-12),\nthe extended coding style guide and requires adherence to [PSR-1](https://www.php-fig.org/psr/psr-1),\nthe basic coding standard. These are minimal specifications and don't address all factors, including things like:\n\n- whitespace around operators\n- alignment of array keys and operators\n- alignment of object operations\n- how to format multi-line conditionals\n- what and what not to import, and how\n- etc.\n\nContributors have different coding styles and so do the maintainers. During code reviews there are regularly\ndiscussions about spaces and alignments, where and when was said that a function needs to be imported. And\nthat's where this coding standard comes in: To have internal consistency in a component and between components.\n\n## Installation\n\n1. Install the module via composer by running:\n\n   ```bash\n   composer require --dev laminas/laminas-coding-standard\n   ```\n\n2. Add composer scripts into your `composer.json`:\n\n   ```json\n   \"scripts\": {\n     \"cs-check\": \"phpcs\",\n     \"cs-fix\": \"phpcbf\"\n   }\n   ```\n\n3. Create file `phpcs.xml` on base path of your repository with this content:\n\n   ```xml\n   \u003c?xml version=\"1.0\"?\u003e\n   \u003cruleset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n            xsi:noNamespaceSchemaLocation=\"vendor/squizlabs/php_codesniffer/phpcs.xsd\"\u003e\n\n       \u003carg name=\"basepath\" value=\".\"/\u003e\n       \u003carg name=\"cache\" value=\".phpcs-cache\"/\u003e\n       \u003carg name=\"colors\"/\u003e\n       \u003carg name=\"extensions\" value=\"php\"/\u003e\n       \u003carg name=\"parallel\" value=\"80\"/\u003e\n\n       \u003c!-- Show progress --\u003e\n       \u003carg value=\"p\"/\u003e\n\n       \u003c!-- Paths to check --\u003e\n       \u003cfile\u003econfig\u003c/file\u003e\n       \u003cfile\u003esrc\u003c/file\u003e\n       \u003cfile\u003etest\u003c/file\u003e\n\n       \u003c!-- Include all rules from the Laminas Coding Standard --\u003e\n       \u003crule ref=\"LaminasCodingStandard\"/\u003e\n   \u003c/ruleset\u003e\n   ```\n\nYou can add or exclude some locations in that file.\nFor a reference please see: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset\n\n## Usage\n\n- To run checks only:\n\n  ```bash\n  composer cs-check\n  ```\n\n- To automatically fix many CS issues:\n\n  ```bash\n  composer cs-fix\n  ```\n\n## Ignoring parts of a File\n\n\u003e Note: Before PHP_CodeSniffer version 3.2.0, `// @codingStandardsIgnoreStart` and `// @codingStandardsIgnoreEnd` were\n\u003e used. These are deprecated and will be removed in PHP_CodeSniffer version 4.0.\n\nDisable parts of a file:\n\n```php\n$xmlPackage = new XMLPackage;\n// phpcs:disable\n$xmlPackage['error_code'] = get_default_error_code_value();\n$xmlPackage-\u003esend();\n// phpcs:enable\n```\n\nDisable a specific rule:\n\n```php\n// phpcs:disable Generic.Commenting.Todo.Found\n$xmlPackage = new XMLPackage;\n$xmlPackage['error_code'] = get_default_error_code_value();\n// TODO: Add an error message here.\n$xmlPackage-\u003esend();\n// phpcs:enable\n```\n\nIgnore a specific violation:\n\n```php\n$xmlPackage = new XMLPackage;\n$xmlPackage['error_code'] = get_default_error_code_value();\n// phpcs:ignore Generic.Commenting.Todo.Found\n// TODO: Add an error message here.\n$xmlPackage-\u003esend();\n```\n\n## Development\n\n\u003e **New rules or Sniffs may not be introduced in minor or bugfix releases and should always be based on the develop\nbranch and queued for the next major release, unless considered a bugfix for existing rules.**\n\nIf you want to test changes against Laminas components or your own projects, install your forked\nlaminas-coding-standard globally with composer:\n\n```bash\n$ composer global config repositories.laminas-coding-standard vcs git@github.com:\u003cFORK_NAMESPACE\u003e/laminas-coding-standard.git\n$ composer global require --dev laminas/laminas-coding-standard:dev-\u003cFORKED_BRANCH\u003e\n\n# For this to work, add this to your path: ~/.composer/vendor/bin\n# Using `-s` prints the rules that triggered the errors so they can be reviewed easily. `-p` is for progress display.\n$ phpcs -sp --standard=LaminasCodingStandard src test\n```\n\nMake sure you remove the global installation after testing from your global composer.json file!!!\n\nDocumentation can be previewed locally by installing [MkDocs](https://www.mkdocs.org/#installation) and run\n`mkdocs serve`. This will start a server where you can read the docs.\n\n## Reference\n\nRules can be added, excluded or tweaked locally, depending on your preferences. More information on how to do this can\nbe found here:\n\n- [Coding Standard Tutorial](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial)\n- [Configuration Options](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options)\n- [Selectively Applying Rules](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset#selectively-applying-rules)\n- [Customisable Sniff Properties](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaminas%2Flaminas-coding-standard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaminas%2Flaminas-coding-standard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaminas%2Flaminas-coding-standard/lists"}