ge-tracker/octane-helpers
最新稳定版本:v1.0.1
Composer 安装命令:
composer require ge-tracker/octane-helpers
包简介
Helper code for Laravel Octane
README 文档
README
This package will provide some basic functionality to our various Laravel Octane projects.
Installation
$ composer require ge-tracker/octane-helpers
After installation, the BootApplication class should be added to the RequestReceived listener in octane.php:
'listeners' => [ ... RequestReceived::class => [ ...Octane::prepareApplicationForNextOperation(), ...Octane::prepareApplicationForNextRequest(), \GeTracker\OctaneHelpers\Listeners\BootApplication::class, ],
Routing
We can make use of Octane's builtin routing to serve requests that bypass Laravel's router (and middleware) to serve data very fast.
With a basic controller that extends OctaneController:
<?php namespace GeTracker\OctaneHelpers\Http\Controllers; class ServerTimeController extends OctaneController { public function getServerTime() { return time(); } }
We can add the following to our web.php routes file:
<?php use GeTracker\OctaneHelpers\Facades\OctaneRoute; OctaneRoute::get('/api/server-time', [ServerTimeController::class, 'getServerTime']);
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-16