{"id":19700295,"url":"https://github.com/appstract/laravel-response-macros","last_synced_at":"2025-04-29T13:31:52.788Z","repository":{"id":62486431,"uuid":"96200422","full_name":"appstract/laravel-response-macros","owner":"appstract","description":"Extra response macro's for Laravel","archived":false,"fork":false,"pushed_at":"2018-01-22T15:07:25.000Z","size":23,"stargazers_count":33,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-03T22:48:31.237Z","etag":null,"topics":["laravel","macros","php","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/appstract.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-04T09:25:52.000Z","updated_at":"2024-02-12T17:24:53.000Z","dependencies_parsed_at":"2022-11-02T10:01:13.548Z","dependency_job_id":null,"html_url":"https://github.com/appstract/laravel-response-macros","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-response-macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-response-macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-response-macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-response-macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appstract","download_url":"https://codeload.github.com/appstract/laravel-response-macros/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224175747,"owners_count":17268390,"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":["laravel","macros","php","response"],"created_at":"2024-11-11T21:05:08.293Z","updated_at":"2024-11-11T21:05:08.956Z","avatar_url":"https://github.com/appstract.png","language":"PHP","funding_links":["https://www.paypal.me/teamappstract/10","https://www.patreon.com/appstract"],"categories":[],"sub_categories":[],"readme":"# Laravel Response Macros\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/appstract/laravel-response-macros.svg?style=flat-square)](https://packagist.org/packages/appstract/laravel-response-macros)\n[![Total Downloads](https://img.shields.io/packagist/dt/appstract/laravel-response-macros.svg?style=flat-square)](https://packagist.org/packages/appstract/laravel-response-macros)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/appstract/laravel-response-macros/master.svg?style=flat-square)](https://travis-ci.org/appstract/laravel-response-macros)\n\nThis package is a collection of custom response macros that you can re-use in a variety of your routes and controllers.\n\n## Installation\n\nYou can install the package via composer:\n\n``` bash\ncomposer require appstract/laravel-response-macros\n```\n\n## Usage\n\n### Message\n``` php\nreturn response()-\u003emessage('hello world!', 200);\n```\n\nResult\n\n``` json\n{\n    \"message\": \"hello world!\"\n}\n```\nWith the Http `Status Code: 200`\n\n### Error\n``` php\nreturn response()-\u003eerror('Something went wrong', $statuscode = 400);\n```\n\nResult\n\n``` json\n{\n    \"message\": \"Something went wrong\"\n}\n```\nWith the Http `Status Code: 400`\n\n### Success\n``` php\nreturn response()-\u003esuccess(['some' =\u003e 'data'], $statuscode = 200);\n```\n\nResult\n\n``` json\n{\n    \"data\": {\"some\": \"data\"}\n}\n```\nWith the Http `Status Code: 200`\n\n### PDF\n\nCreates a (downloadable) PDF response from PDF contents.\n\n``` php\nreturn response()-\u003epdf($pdfData, 'filename.pdf', $download = false);\n```\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nContributions are welcome, [thanks to y'all](https://github.com/appstract/laravel-blade-directives/graphs/contributors) :)\n\n## About Appstract\n\nAppstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on [Medium](https://medium.com/appstract). You can [follow us on Twitter](https://twitter.com/teamappstract), [buy us a beer](https://www.paypal.me/teamappstract/10) or [support us on Patreon](https://www.patreon.com/appstract).\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%2Fappstract%2Flaravel-response-macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappstract%2Flaravel-response-macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappstract%2Flaravel-response-macros/lists"}