访问地址 https://laravel-workerman.iwnweb.com/
https://github.com/mouyong/laravel-octane-workerman/tree/gatewayworker/webman_plugin_require_example
在项目的 composer.json
添加如下内容。可参考 laravel-octane-workerman
的 composer.json
中,scripts
配置
{
// ...
"scripts": {
"post-package-install": [
"JieAnthony\\LaravelOctaneWorkerman\\WebmanPlugin::install"
],
"post-package-update": [
"JieAnthony\\LaravelOctaneWorkerman\\WebmanPlugin::install"
],
"pre-package-uninstall": [
"JieAnthony\\LaravelOctaneWorkerman\\WebmanPlugin::uninstall"
],
// ...
}
// ...
}
composer require webman/push -vvv
route.php
文件Webman\Request
替换为 Illuminate\Http\Request
Webman\Route
替换为 Illuminate\Routing\Router
Route::
调用为 $route->
示例:
// use support\Request;
// use Webman\Route;
use Illuminate\Http\Request;
use Illuminate\Routing\Router;
app('router')->middleware(['web'])->group(function (Router $route) {
/**
* 推送js客户端文件
*/
// here before
// Route::any('plugin/webman/push/push.js', function (Request $request) {
// return response()->file(base_path() . '/vendor/webman/push/src/push.js');
// });
// here after
$route->any('plugin/webman/push/push.js', function (Request $request) {
return response()->file(base_path() . '/vendor/webman/push/src/push.js');
});
});
composer dump-autoload
,让项目自动自行 @php artisan package:discover --ansi
命令
composer du # 简写
赞
赞