{"id":19585037,"url":"https://github.com/patiencemanzen/patienceman-custom-handler","last_synced_at":"2026-04-16T02:31:22.367Z","repository":{"id":161422711,"uuid":"635852615","full_name":"patiencemanzen/patienceman-custom-handler","owner":"patiencemanzen","description":"Provide a convenient way creating single action handlers. The idea of a action handler is a single action controller that means a unique class handles each action","archived":false,"fork":false,"pushed_at":"2023-09-01T12:34:43.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T14:44:06.522Z","etag":null,"topics":["handlers","laravel","libray"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patiencemanzen.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-05-03T15:35:01.000Z","updated_at":"2023-05-04T07:29:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1bade94-d88b-461b-a9d7-92f2723fdd03","html_url":"https://github.com/patiencemanzen/patienceman-custom-handler","commit_stats":null,"previous_names":["patience-man/patienceman-custom-handler","patiencemanzen/patienceman-custom-handler"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/patiencemanzen/patienceman-custom-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patiencemanzen%2Fpatienceman-custom-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patiencemanzen%2Fpatienceman-custom-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patiencemanzen%2Fpatienceman-custom-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patiencemanzen%2Fpatienceman-custom-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patiencemanzen","download_url":"https://codeload.github.com/patiencemanzen/patienceman-custom-handler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patiencemanzen%2Fpatienceman-custom-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31868487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["handlers","laravel","libray"],"created_at":"2024-11-11T07:52:34.460Z","updated_at":"2026-04-16T02:31:22.312Z","avatar_url":"https://github.com/patiencemanzen.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CustomHandler | Patienceman\n\nProvide a convenient way creating single action handlers.\nThe idea of a action handler is a single action controller that means\na unique class handles each action\n\n## Installation\n\nInstall the package doesn't require much requirement except to use the following command in the laravel terminal,  and you're good to go.\n\n```bash\ncomposer require patienceman/custom-handler\n```\n\n## Usage\n\nTo start working with handler, u need to run command :tada:\nin your custom directories:\n\n```bash\nphp artisan make:handler NewStartupHandler\n```\n\nso it will create the filter file for u, Just in\n\n```PHP\n    App\\Handlers\n```\n\n```PHP\nnamespace App\\Handlers;\n\nuse Patienceman\\CustomHandler\\Handler;\n\nclass NewStartupHandler extends Handler {\n    /**\n     * Custom execution from Handler Pipeline\n     * @return Exception|void\n     */\n    public function execute() {\n        // do whatever action inside handler\n    }\n}\n```\n\nSo you may want even to specify the custom path for your Handler, Just relax and add it in front of your Handler name.\nLet's take again our current example.\n\n```bash\nphp artisan make:handler Model/DatabaseHandler\n```\n\nSo far so good, Let see how you can your handlers anywhere in controller or services or ...:\n\n```PHP\nnamespace App\\Http\\Controllers;\n\nuse App\\Handlers\\NewStartupHandler;\nuse Patienceman\\CustomHandler\\CustomHandler;\n\nclass TestBuilderController extends Controller {\n    /**\n     * Display a listing of the resource.\n     *\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function index() {\n        $handler = CustomHandler::handle(new NewStartupHandler());\n    }\n}\n```\n\nBut don't worry, you chain many handlers as you want, what you need to do is keep add ``` -\u003ehandle() ```, let see it in action:\n\n```PHP\nnamespace App\\Http\\Controllers;\n\nuse App\\Handlers\\NewStartupHandler;\nuse App\\Handlers\\NewCompanyHandler;\nuse Patienceman\\CustomHandler\\CustomHandler;\n\nclass TestBuilderController extends Controller {\n    /**\n     * Display a listing of the resource.\n     *\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function index() {\n        $handler = CustomHandler::handle(new NewStartupHandler())\n                                -\u003ehandle(new NewCompanyHandler());\n    }\n}\n```\n\nAnd now once your controller get execution, all your handler will run.\n\n## Exchanges of data\n\nThere might a time you need to store and exchange tou data throughout your handlers,\nThis package provide convinient way to do so, by just use ``` -\u003ecollect(array data) ``` to collect data and ``` -\u003ecollection() ``` to get collected data, let take example:\n\nIn our ``` NewStartupHandler ```:\n\n```PHP\nnamespace App\\Handlers;\n\nuse Patienceman\\CustomHandler\\Handler;\nuse App\\Models\\Startup;\n\nclass NewStartupHandler extends Handler {\n    /**\n     * Custom execution from Handler Pipeline\n     * @return Exception|void\n     */\n    public function execute() {\n        $startup = Startup::create([ 'name' =\u003e \"MorganTv\" ]);\n        $this-\u003ecollect([ 'startup' =\u003e $startup ]);\n    }\n}\n```\n\nThat look to clear 🎉, so Let see how you can call the collected data anywhere your want, for example in our\n``` NewCompanyHandler ``` class:\n\n```PHP\nnamespace App\\Handlers;\n\nuse Patienceman\\CustomHandler\\Handler;\n\nclass NewCompanyHandler extends Handler {\n    /**\n     * Custom execution from Handler Pipeline\n     * \n     * @return Exception|void\n     */\n    public function execute() {\n        $startup = $this-\u003ecollection()-\u003eget('startup');\n    }\n}\n```\n\n🚨 You've seen where we are using ``` -\u003ecollection() ``` function, and this is coming from Laravel collection, you can read more about it to their website: [Laravel collection avalibale method](https://laravel.com/docs/8.x/collections#available-methods) for more about getting and filtering data.\n\nThere is also another way to get collected data, for instance when you're outside handler, and to apply this you use same functionality\nas ``` -\u003ecollection() ``` after your handler, take a look:\n\n```PHP\nnamespace App\\Http\\Controllers;\n\nuse App\\Handlers\\NewStartupHandler;\nuse App\\Handlers\\NewCompanyHandler;\nuse Patienceman\\CustomHandler\\CustomHandler;\n\nclass TestBuilderController extends Controller {\n    /**\n     * Display a listing of the resource.\n     *\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function index() {\n        $handler = CustomHandler::handle(new NewStartupHandler())\n                                -\u003ehandle(new NewCompanyHandler())\n                                -\u003ecollection()\n                                -\u003eget('startup') // or -\u003eget(), -\u003efilter() -\u003esort();\n    }\n}\n```\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## Connect with Me\n\n\u003cp align=\"center\"\u003e\n \u003ca href=\"https://www.linkedin.com/in/manirabona-patience-3b08051b4\"\u003e\n \u003cimg alt=\"Linkedin\" title=\"Manirabona patience Linkedin\" src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/manirabona-programer/manirabona-programer\"\u003e\u003cimg alt=\"Github\" title=\"Manirabona patience Github\" src=\"https://img.shields.io/badge/GitHub-100000?style=for-the-badge\u0026logo=github\u0026logoColor=white\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.instagram.com/manirabona_walker\"\u003e\u003cimg alt=\"Instagram\" title=\"Manirabona Patience Instagram\" src=\"https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge\u0026logo=instagram\u0026logoColor=white\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://twitter.com/ManirabonaW\"\u003e\u003cimg alt=\"Twitter\" title=\"Manirabona Patience Twitter\" src=\"https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge\u0026logo=twitter\u0026logoColor=white\"\u003e\u003c/a\u003e\n   \u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatiencemanzen%2Fpatienceman-custom-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatiencemanzen%2Fpatienceman-custom-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatiencemanzen%2Fpatienceman-custom-handler/lists"}