myerscode/laravel-sub-request
最新稳定版本:8.0.1
Composer 安装命令:
composer require myerscode/laravel-sub-request
包简介
A helper and facade for making internal API sub requests to your application
README 文档
README
a helper and facade for making internal sub requests to your application API
By sending a sub request within the application, you can simply consume your applications API without having to send seperate, slower HTTP requests.
Install
You can install this package via composer:
composer require myerscode/laravel-sub-request
Setup
Laravel >=5.5
The package will be auto discovered.
Laravel 5.4
Add Myerscode\Laravel\SubRequest\SubRequestProvider to the providers array in config/app.php
Usage
In your controller you can inject the sub request component into your class or use the SubRequest facade or the global helper method subrequest.
namespace App\Controllers; class MyController { public function __contstruct(Dispatcher $subRequest) { $this->subRequest = $subRequest; } public function routeOne() { return $this->subRequest->dispatch('POST', '/auth', ['foo' => 'bar']) } public function routeTwo() { return SubRequest::dispatch('GET', '/details', ['foo' => 'bar']) } public function routeThree() { return subrequest('GET', '/details', ['foo' => 'bar']) } ... }
统计信息
- 总下载量: 45.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-05