{"id":33974684,"url":"https://github.com/laratoolbox/responder","last_synced_at":"2025-12-13T01:49:33.318Z","repository":{"id":57011866,"uuid":"330366219","full_name":"laratoolbox/responder","owner":"laratoolbox","description":"Easily send response to api requests for laravel.","archived":false,"fork":false,"pushed_at":"2021-01-26T13:00:42.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-05T19:09:11.350Z","etag":null,"topics":["api","api-response","laravel","response"],"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/laratoolbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-17T10:35:55.000Z","updated_at":"2024-05-24T14:18:17.000Z","dependencies_parsed_at":"2022-08-21T13:40:46.487Z","dependency_job_id":null,"html_url":"https://github.com/laratoolbox/responder","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":"laratoolbox/package-skeleton","purl":"pkg:github/laratoolbox/responder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laratoolbox%2Fresponder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laratoolbox%2Fresponder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laratoolbox%2Fresponder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laratoolbox%2Fresponder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laratoolbox","download_url":"https://codeload.github.com/laratoolbox/responder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laratoolbox%2Fresponder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27697971,"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","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"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":["api","api-response","laravel","response"],"created_at":"2025-12-13T01:49:31.606Z","updated_at":"2025-12-13T01:49:33.303Z","avatar_url":"https://github.com/laratoolbox.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Responder\n\nEasily respond to api requests.\n\n# Requirement\n\u003e Laravel \u003e= 5.5\n\n# Installation\n\nYou can install the package via composer:\n\n```bash\n$ composer require laratoolbox/responder\n```\n\n# Usage\n\nAfter installation, you can use helper `responder` function.\n\n```php\nreturn responder()\n        -\u003eaddHeader('X-Secret1', 'secret1')\n        -\u003eaddHeader('X-Secret2', 'secret2')\n        -\u003eaddHeader('X-Secret3', 'secret3')\n        -\u003esetData(\\App\\Models\\User::select('id', 'name')-\u003efind(1))\n        -\u003eaddExtraData('custom-key', 'custom-value')\n        -\u003esend();\n```\n\nSee response below:\n\n```text\nHTTP/1.1 200 OK\nContent-Type: application/json\nX-Secret1: secret1\nX-Secret2: secret2\nX-Secret3: secret3\n\n{\n    \"code\": 0,\n    \"message\": null,\n    \"data\": {\n        \"id\": 1,\n        \"name\": \"Semih ERDOGAN\"\n    },\n    \"custom-key\": \"custom-value\"\n}\n```\n\nAlso, you have `ResponderException` that you can throw it any time required.\n\n```php\nthrow new \\LaraToolbox\\Responder\\Exceptions\\ResponderException(\n    \\LaraToolbox\\Responder\\ResponseCodes::ERROR,\n    $customData = [1,2,3]\n);\n```\n\nSee response below:\n\n```text\nHTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n    \"code\": 120,\n    \"message\": \"An error occurred\",\n    \"data\": [\n        1,\n        2,\n        3\n    ]\n}\n```\n\n### All methods that responder has.\n#### send\n  - Parameter `null|mixed $data` (if set calls setData method behind the scenes)\n#### setHttpStatusCode\n  - Parameter `int $statusCode`\n#### setResponseMeta\n  - Parameter `array $responseMeta`\n#### setResponseCode\n  - Parameter `int $responseCode`\n#### setResponseMessage\n  - Parameter `string $responseMessage`\n#### setData\n  - Parameter `mixed $data`\n#### addExtraData\n  - Parameter `string $key`\n  - Parameter `mixed $value`\n#### addHeader\n  - Parameter `string $key`\n- Parameter `string|integer|numeric $value`\n\n# Testing\n\n// TODO:\n\n# Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n# Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n# Security\n\nIf you discover any security related issues, please email hasansemiherdogan@gmail.com instead of using the issue tracker.\n\n Credits\n\n- [Semih ERDOGAN](https://github.com/laratoolbox)\n- [Dincer DEMIRCIOGLU](https://github.com/dinncer)\n- [All contributors](https://github.com/laratoolbox/database-viewer/graphs/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%2Flaratoolbox%2Fresponder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaratoolbox%2Fresponder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaratoolbox%2Fresponder/lists"}