https://github.com/sc0vu/msgpack
The lumen api response wrapper for rybakit/msgpack.
https://github.com/sc0vu/msgpack
api laravel lumen msgpack rest-api
Last synced: about 2 months ago
JSON representation
The lumen api response wrapper for rybakit/msgpack.
- Host: GitHub
- URL: https://github.com/sc0vu/msgpack
- Owner: sc0Vu
- License: mit
- Created: 2017-05-27T08:10:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-08T12:04:56.000Z (about 9 years ago)
- Last Synced: 2025-01-30T01:41:35.254Z (over 1 year ago)
- Topics: api, laravel, lumen, msgpack, rest-api
- Language: PHP
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# msgpack
[](https://travis-ci.org/sc0Vu/msgpack)
[](https://codecov.io/gh/sc0Vu/msgpack)
[](https://www.versioneye.com/user/projects/59298ac60546cb00422b3b66)
[](https://packagist.org/packages/guancheng/msgpack)
The lumen api response wrapper for rybakit/msgpack.
# Install
composer require guancheng/msgpack
or
clone / download this repo
# Usage
### Response
use Illuminate\Routing\Controller;
use LGC\Msgpack\MsgpackResponse;
class TestController extends Controller
{
public function test()
{
return new MsgpackResponse([
'success' => true
]);
}
}
If you want to return Arrayable object, just do it!
use Illuminate\Support\Collection;
use Illuminate\Routing\Controller;
use LGC\Msgpack\MsgpackResponse;
class TestController extends Controller
{
public function test()
{
return new MsgpackResponse([
'success' => true,
'data' => new Collection([
'hello' => 'lumtify'
])
]);
}
}
> When use arrayable types you have to notice: due to we don't remember pack data type, so the getData() always return array
### Test
use LGC\Msgpack\MsgpackConcern;
class TestApiTest extends PHPUnit_Framework_TestCase
{
use MsgpackConcern;
public function testShouldSeeMsgpack()
{
$this->shouldSeeMsgpack();
}
}
# Development
clone the repo
composer install
# Roadmap
> Make other laravel data type transformer.
# Licence
MIT
## Support on Beerpay
Hey dude! Help me out for a couple of :beers:!
[](https://beerpay.io/sc0Vu/msgpack) [](https://beerpay.io/sc0Vu/msgpack?focus=wish)