{"id":37011987,"url":"https://github.com/felipebool/crook","last_synced_at":"2026-01-14T01:01:57.511Z","repository":{"id":62504025,"uuid":"120643836","full_name":"felipebool/crook","owner":"felipebool","description":"Simple hook management tool made with PHP","archived":false,"fork":false,"pushed_at":"2020-09-24T15:34:52.000Z","size":352,"stargazers_count":59,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-10T15:28:10.482Z","etag":null,"topics":["composer","git","githook","hooks","packagist","php"],"latest_commit_sha":null,"homepage":"","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/felipebool.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-02-07T16:54:06.000Z","updated_at":"2025-02-11T21:33:51.000Z","dependencies_parsed_at":"2022-11-02T12:31:17.885Z","dependency_job_id":null,"html_url":"https://github.com/felipebool/crook","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/felipebool/crook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipebool%2Fcrook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipebool%2Fcrook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipebool%2Fcrook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipebool%2Fcrook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipebool","download_url":"https://codeload.github.com/felipebool/crook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipebool%2Fcrook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["composer","git","githook","hooks","packagist","php"],"created_at":"2026-01-14T01:01:56.441Z","updated_at":"2026-01-14T01:01:57.356Z","avatar_url":"https://github.com/felipebool.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/felipebool/crook.svg?branch=master)](https://travis-ci.org/felipebool/crook)\n[![Maintainability](https://api.codeclimate.com/v1/badges/dda7bbc045a955530da4/maintainability)](https://codeclimate.com/github/felipebool/crook/maintainability)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2849859fd1ad4d299bf7403a85171319)](https://www.codacy.com/app/felipebool/crook?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=felipebool/crook\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/2849859fd1ad4d299bf7403a85171319)](https://www.codacy.com/app/felipebool/crook?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=felipebool/crook\u0026utm_campaign=Badge_Coverage)\n\n# Crook\nFirst of all, Crook is a work in progress.\n\nIf you are not familiar with git hooks, you may want to read [Git Hooks documentation](https://git-scm.com/docs/githooks) first.\n\nCrook is the simplest way to define and manage your Git Hooks. Its aim is to allow scripts from your composer.json run when git hook actions are triggered. \n\n## Usage\nThe aim of this project is to be as simple as possible, thus, you won't have to write any PHP code, you just need to install any packages from packagist and then make them run for partucular git hooks. The process is explained in the following sections.\n\n### Installation\nJust run\n\n```$ composer require felipebool/crook --dev```\n\n### Init Crook\n```$ vendor/bin/crook init``` will create crook.json configuration file and theHook in the root of your project.\n\n### Add a new hook\n```$ vendor/bin/crook add hook-name action-name``` will create a symbolic link from .git/hooks/hook-name to theHook, enabling that hook.\n\n### Remove a hook\n```$ vendor/bin/crook remove hook-name``` will remove the symbolic link .git/hooks/hook-name, disabling that hook.\n\n### Add a action to composer.json\nWhen you add a new action using ```add``` you need to add what is expected to run when that action is triggered inside you composer.json. To do that, you must create a new entry inside the section ```scripts``` and then define what must run there.\n\n## Crook configuration file\nCrook uses a json configuration file just like composer, it is called crook.json. The configuration is made, basically, by writting as a key the git hook name and as value the respective script entry in composer.json. See the following example\n```json\n{\n  \"pre-commit\": \"code-check\",\n  \"composer\": \"/home/felipe/bin/composer\"\n}\n```\nAlthough you are able to edit crook.json by yourself, you should do it using ```$ vendor/bin/crook``` in order to create the symbolic links. Only the composer path **must** be set manually. The mechanism is explained in the next section.\n\n## The mechanism\nEvery time you run a\n```vendor/bin/crook add hook-name action-name```\nCrook creates a symbolic link from .git/hooks/hook-name to /your/project/hook/theHook, simple as that.\n\nNow, when git trigger the action hook-name, it will follow the link to /your/project/hook/theHook and Crook will then look for a script named action-name inside your project's composer.json and will execute the commands defined there.\n\n### Adding code validation using phpcs before any commit\nIn order to check your code against PSR2, you must do this\n\n#### Add the script action inside composer.json\n```\n\"scripts\": {\n  \"code-check\": \"phpcs --standard=PSR2 src/\",\n}\n```\n\n#### Initialize crook\n```$ vendor/bin/crook init```\n\n#### Bind code-check to pre-commit hook\n```$ vendor/bin/crook add pre-commit code-check```\n\nNext time you run ```$ git commit -m 'some message'``` crook will run the code defined inside code-check and will prevent code from being commited if the check fail.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipebool%2Fcrook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipebool%2Fcrook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipebool%2Fcrook/lists"}