Package Data | |
---|---|
Maintainer Username: | Rokr |
Maintainer Contact: | hello@appstract.team (Bob Krijnen) |
Package Create Date: | 2017-07-04 |
Package Last Update: | 2018-01-22 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:00:36 |
Package Statistics | |
---|---|
Total Downloads: | 1,415 |
Monthly Downloads: | 7 |
Daily Downloads: | 0 |
Total Stars: | 33 |
Total Watchers: | 5 |
Total Forks: | 4 |
Total Open Issues: | 0 |
This package is a collection of custom response macros that you can re-use in a variety of your routes and controllers.
You can install the package via composer:
composer require appstract/laravel-response-macros
return response()->message('hello world!', 200);
Result
{
"message": "hello world!"
}
With the Http Status Code: 200
return response()->error('Something went wrong', $statuscode = 400);
Result
{
"message": "Something went wrong"
}
With the Http Status Code: 400
return response()->success(['some' => 'data'], $statuscode = 200);
Result
{
"data": {"some": "data"}
}
With the Http Status Code: 200
Creates a (downloadable) PDF response from PDF contents.
return response()->pdf($pdfData, 'filename.pdf', $download = false);
$ composer test
Contributions are welcome, thanks to y'all :)
Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.
The MIT License (MIT). Please see License File for more information.