{"id":26659968,"url":"https://github.com/mpstr24/laravel-api-responses","last_synced_at":"2026-04-29T11:01:27.395Z","repository":{"id":281740885,"uuid":"946287788","full_name":"MPSTR24/laravel-api-responses","owner":"MPSTR24","description":"Laravel package that provides API response functions to help improve consistency of API response codes across your projects.","archived":false,"fork":false,"pushed_at":"2025-09-10T21:24:38.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T21:54:36.944Z","etag":null,"topics":["api","api-response","laravel","laravel-package"],"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/MPSTR24.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-10T22:54:41.000Z","updated_at":"2025-09-10T21:23:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d7b389f-c1fb-40fb-8b9f-fab6baede730","html_url":"https://github.com/MPSTR24/laravel-api-responses","commit_stats":null,"previous_names":["mpstr24/laravel-api-responses"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/MPSTR24/laravel-api-responses","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPSTR24%2Flaravel-api-responses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPSTR24%2Flaravel-api-responses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPSTR24%2Flaravel-api-responses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPSTR24%2Flaravel-api-responses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MPSTR24","download_url":"https://codeload.github.com/MPSTR24/laravel-api-responses/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPSTR24%2Flaravel-api-responses/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32422532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["api","api-response","laravel","laravel-package"],"created_at":"2025-03-25T11:16:55.409Z","updated_at":"2026-04-29T11:01:27.390Z","avatar_url":"https://github.com/MPSTR24.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Laravel API Responses\n\nThis package provides API response functions via a trait to help improve consistency of API response codes across your projects.\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mpstr24/laravel-api-responses/run-tests.yml?branch=main)\n![Packagist Version](https://img.shields.io/packagist/v/mpstr24/laravel-api-responses)\n![Packagist Downloads](https://img.shields.io/packagist/dt/mpstr24/laravel-api-responses)\n\n## Features\n\n- Pre-made functions of the most common API responses.\n\n## Installation\n\nInstall the package via Composer:\n\n```bash\ncomposer require mpstr24/laravel-api-responses\n```\n\n\n## Usage/Examples\n\nFirst add the trait to your controller.\n\n```Bash\nuse ApiResponseTrait;\n```\n\nAll methods, except from \"No Content\" allow for a message and data to be returned.\nCustom messages also allow you to choose the status code.\n\nExamples of each below.\n\n### Success - 200\n\n```Bash\npublic function success()\n{\n  return $this-\u003eapiSuccess();\n}\n```\n\n### Created - 201\n\n```Bash\npublic function created()\n{\n    return $this-\u003eapiCreated();\n}\n```\n\n### Accepted - 202\n\n```Bash\npublic function accepted()\n{\n    return $this-\u003eapiAccepted();\n}\n```\n\n### No Content - 204\n```Bash\npublic function noContent()\n{\n    return $this-\u003eapiNoContent();\n}\n```\n\n### Bad Request - 400\n```Bash\npublic function badRequest()\n{\n    return $this-\u003eapiBadRequest();\n}\n```\n\n### Unauthorized - 401\n```Bash\npublic function unauthorized()\n{\n    return $this-\u003eapiUnauthorized();\n}\n```\n\n### Forbidden - 403\n```Bash\npublic function forbidden()\n{\n    return $this-\u003eapiForbidden();\n}\n```\n\n### Not Found - 404\n```Bash\npublic function notFound()\n{\n    return $this-\u003eapiNotFound();\n}\n```\n\n### Teapot - 418\n```Bash\npublic function teapot()\n{\n    return $this-\u003eapiTeapot();\n}\n```\n\n### Unprocessable - 422\n```Bash\npublic function unprocessable()\n{\n    return $this-\u003eapiUnprocessable();\n}\n```\n\n### Too Many Requests - 429\n```Bash\npublic function tooManyRequests()\n{\n    return $this-\u003eapiTooManyRequests();\n}\n```\n\n### Server Error - 500\n```Bash\npublic function serverError()\n{\n    return $this-\u003eapiInternalServerError();\n}\n```\n\n### Custom response\n```Bash\npublic function apiCustomResponse()\n{\n    return $this-\u003eapiCustom('Custom', null, 201);\n}\n```\n\n\n## Roadmap\n\n- [ ] Support for resources\n- [ ] Expand into more helpful API features\n- [x] Larastan goals\n    - [x] 5\n    - [x] 6\n    - [x] 7\n    - [x] 8\n    - [x] 9\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpstr24%2Flaravel-api-responses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpstr24%2Flaravel-api-responses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpstr24%2Flaravel-api-responses/lists"}