tzookb / api-responder by tzookb

laravel api response helper
14
0
2
Package Data
Maintainer Username: tzookb
Maintainer Contact: tzookb@gmail.com (tzookb)
Package Create Date: 2015-06-23
Package Last Update: 2015-06-24
Language: PHP
License: MIT
Last Refreshed: 2024-04-25 15:04:35
Package Statistics
Total Downloads: 14
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Simplifying the Api response

this package was built for easying the return of an api reponse, currently it returns only json, but could easily support xml or whatever...

the use is easy:

  return $apiResponder
        ->setData(['someData'=>1, 'someData2'=>2])
        ->setMeta(['page'=>1, 'extra'=>'for_info_stuff'])
        ->setRef(1) //defaults to 1, this is for the general api code, like 0 success, 1 data error, 2 auth error etc
        ->respond(); //and this returns the "Response" object currently JsonResponse