{"id":15561157,"url":"https://github.com/mreduar/laravel-phpcs","last_synced_at":"2025-04-15T16:58:38.865Z","repository":{"id":37248854,"uuid":"451978642","full_name":"mreduar/laravel-phpcs","owner":"mreduar","description":"PHP Codesniffer ruleset to follow Laravel's coding style","archived":false,"fork":false,"pushed_at":"2022-11-02T20:02:16.000Z","size":45,"stargazers_count":38,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T16:58:34.550Z","etag":null,"topics":["hacktoberfest","laravel","laravel-framework","laravel-package","phpcs","phpcs-laravel","phpcs-phpcbf","phpcs-standard"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mreduar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-25T17:37:37.000Z","updated_at":"2025-01-21T06:34:03.000Z","dependencies_parsed_at":"2023-01-21T07:02:51.492Z","dependency_job_id":null,"html_url":"https://github.com/mreduar/laravel-phpcs","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreduar%2Flaravel-phpcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreduar%2Flaravel-phpcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreduar%2Flaravel-phpcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreduar%2Flaravel-phpcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mreduar","download_url":"https://codeload.github.com/mreduar/laravel-phpcs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249116228,"owners_count":21215142,"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":["hacktoberfest","laravel","laravel-framework","laravel-package","phpcs","phpcs-laravel","phpcs-phpcbf","phpcs-standard"],"created_at":"2024-10-02T16:05:47.541Z","updated_at":"2025-04-15T16:58:38.846Z","avatar_url":"https://github.com/mreduar.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Codesniffer ruleset to follow Laravel's coding style\n\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![PR friendly repository](https://img.shields.io/badge/Pull--Request-are%20welcome!-ff69b4)](/compare)\n\n[php codesniffer](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset) ruleset for laravel or any other php projects.\n\n## Installation\n**[*]** Install using composer\n\n```bash\ncomposer require mreduar/laravel-phpcs --dev\n```\n\n**[*]** Install manually\n\n1. Copy the `phpcs.xml` file into your project root.\n2. Descoment lines `\u003cfile\u003eapp\u003c/file\u003e` and the others in `phpcs.xml` file.\n3. Because this package uses third party standards that are not in phpcs you need to install these package.\n   1. `composer require slevomat/coding-standard`\n4. Run `phpcs .` to check your project.\n\n## Usage\n\n### Enabling the rules\n\n\u003e Only neccesary if you installed as a package using composer!\n\n`php artisan vendor:publish --provider=\"Mreduar\\LaravelPhpcs\\LaravelPhpcsServiceProvider\" --tag=\"ruleset\"`\n\nThis will publish to your root directory the following file\n\n```xml\n\u003c?xml version=\"1.0\"?\u003e\n\u003cruleset\u003e\n    \u003carg name=\"basepath\" value=\".\"/\u003e\n\n    \u003cfile\u003e./app\u003c/file\u003e\n    \u003cfile\u003e./config\u003c/file\u003e\n    \u003cfile\u003e./resources\u003c/file\u003e\n    \u003cfile\u003e./routes\u003c/file\u003e\n    \u003cfile\u003e./tests\u003c/file\u003e\n\n    \u003crule ref=\"./vendor/mreduar/laravel-phpcs/phpcs.xml\"/\u003e\n\u003c/ruleset\u003e\n```\n\nOptionally you can also publish a git hook that will help you to never overlook smelly code.\n\n`php artisan vendor:publish --provider=\"Mreduar\\LaravelPhpcs\\LaravelPhpcsServiceProvider\" --tag=\"hook\"`\n\nThe file will be published in its root directory `.git/hooks/pre-commit`\nSo every time you try to commit `phpcs` will first check that you have everything correct.\n\n```bash\n$ git commit -m \"test\"\n[1/1] code sniffer        OK!\n[master a6133d7] test\n 1 file changed, 1 insertion(+), 1 deletion(-)\n```\n\nif you have any errors the commit will be cancelled.\n\n\n### Sniffing code\nUse php CodeSniffer commands, pointed towards your xml file, to sniff the code\nusing the new ruleset.\n\n`vendor/bin/phpcs`\n`vendor/bin/phpcbf`\n\n#### Sniffing code in PHPStorm\n\nSee [PHP Code Sniffer in PhpStorm](https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm) on how to set up CodeSniffer in PHPStorm.\n\n#### Sniffing code Visual Studio Code\n\nSee [PHP Sniffer by wongjn](https://marketplace.visualstudio.com/items?itemName=wongjn.php-sniffer) or other [phpcs](https://marketplace.visualstudio.com/search?term=phpcs\u0026target=VSCode\u0026category=All%20categories\u0026sortBy=Relevance) plugins for more information about PHP Code Sniffer in Visual Studio Code.\n\n--------------------------------------------------------------------------------\n\n\n## Contributing\n\nAll changes that makes the sniffer more accurate towards _Laravel_'s coding standard\nis always highly appreciated and welcome.\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for more details.\n\n## Credits\n\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmreduar%2Flaravel-phpcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmreduar%2Flaravel-phpcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmreduar%2Flaravel-phpcs/lists"}