{"id":18654682,"url":"https://github.com/juampi92/phecks","last_synced_at":"2025-04-11T17:31:34.207Z","repository":{"id":49757095,"uuid":"507587245","full_name":"juampi92/phecks","owner":"juampi92","description":"PHP Checks","archived":false,"fork":false,"pushed_at":"2025-02-12T15:20:00.000Z","size":135,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T17:24:54.786Z","etag":null,"topics":["ci-cd","laravel","phecks","php","testing"],"latest_commit_sha":null,"homepage":"https://juampi92.gitbook.io/phecks/","language":"PHP","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/juampi92.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-26T13:51:06.000Z","updated_at":"2025-02-12T15:19:29.000Z","dependencies_parsed_at":"2023-02-02T14:31:45.490Z","dependency_job_id":null,"html_url":"https://github.com/juampi92/phecks","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fphecks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fphecks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fphecks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fphecks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juampi92","download_url":"https://codeload.github.com/juampi92/phecks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248449766,"owners_count":21105558,"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":["ci-cd","laravel","phecks","php","testing"],"created_at":"2024-11-07T07:16:13.709Z","updated_at":"2025-04-11T17:31:29.191Z","avatar_url":"https://github.com/juampi92.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cp\u003e\n        \u003ch1\u003e\n            Phecks\n        \u003c/h1\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://juanpablo2.gitbook.io/phecks/\" target=\"_blank\"\u003eDocumentation\u003c/a\u003e |\n    \u003ca href=\"#credits\"\u003eCredits\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/juampi92/phecks\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/juampi92/phecks.svg?style=flat-square\" alt=\"Latest Version on Packagist\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/juampi92/phecks\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dm/juampi92/phecks.svg?style=flat-square\" alt=\"Downloads Per Month\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/juampi92/phecks/actions?query=workflow%3Arun-tests+branch%3Amain\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/juampi92/phecks/run-tests?label=tests\u0026style=flat-square\" alt=\"GitHub Tests Action Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/juampi92/phecks\"\u003e\u003cimg src=\"https://img.shields.io/packagist/php-v/juampi92/phecks.svg?style=flat-square\" alt=\"PHP from Packagist\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nPhecks (stands for PHP-Checks) is a custom Check Runner. It will run custom checks in your codebase and will make a report of violations that need fixing.\n\n## What is it for?\n\n- For big teams to align on a styleguide beyond linting.\n- Used as an extra set of eyes during the Code Review.\n- Teams make their own checks according to their architectural decisions and styleguides.\n\n[See what checks are for](https://juanpablo2.gitbook.io/phecks/about-phecks/what-is-a-check).\n\nOn its own, Phecks doesn't contain any checks.\nYou and your team are responsible for defining and implementing these checks based on your architectural decisions.\n\nPhecks will provide you with a structure to develop and run these checks easily.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require juampi92/phecks --dev\n```\n\nRead the full installation instructions in the [documentation](https://juanpablo2.gitbook.io/phecks/).\n\n## Usage\n\nCreate a Check to make sure your team's architectural decisions are respected:\n\n```php\n/**\n * @implements Check\u003cReflectionClass\u003e\n */\nclass ConsoleClassesMustBeSuffixedWithCommandCheck implements Check\n{\n    public function __construct(\n        private readonly ClassSource $source,\n    ) {}\n\n    /**\n     * This method will get all the possible matches.\n     */\n    public function getMatches(): MatchCollection\n    {\n        return $this-\u003esource\n            -\u003edirectory('./app/Console')\n            -\u003erun()\n            -\u003ereject(fn (ReflectionClass $class): bool =\u003e $class-\u003eisAbstract())\n            -\u003epipe(new WhereExtendsClassFilter(\\Illuminate\\Console\\Command::class));\n    }\n\n    /**\n     * processMatch will check if the matches are\n     * actual violations, and format them properly.\n     */\n    public function processMatch($match, FileMatch $file): array\n    {\n        if (Str::endsWith($match-\u003egetName(), 'Command')) {\n            return [];\n        }\n\n        return [\n            ViolationBuilder::make()-\u003emessage('Command classes must be suffixed with \\'Command\\''),\n        ];\n    }\n}\n```\n\nAdd the class in the config `phecks.checks`\n\nAnd run the following:\n\n```bash\nphp artisan phecks:run\n```\n\n![error-output](docs/error-output.png)\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Credits\n\n- [juampi92](https://github.com/juampi92)\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%2Fjuampi92%2Fphecks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuampi92%2Fphecks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuampi92%2Fphecks/lists"}