katsana/minions-polyfill

Minions 组件服务器(Polyfill)使用 Laravel 路由

v1.2.1 2020-09-08 01:07 UTC

This package is auto-updated.

Last update: 2024-09-15 12:12:00 UTC


README

tests Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

安装

Minions 可以通过 composer 安装

composer require "katsana/minions-polyfill=^1.0"

请确保您已经安装了 Minions 并查阅了 安装和配置文档

使用方法

要使用 Laravel 路由处理 RPC 请求,您只需设置 URI 和 TLD 域名来处理请求。为此,此包已经为 Illuminate\Routing\Router 添加了一个宏。

建议您将命令添加到 App\Providers\RouteServiceProvider::map() 方法中。

<?php

namespace App\Providers;

use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;

class RouteServiceProvider extends ServiceProvider
{
    // ...
    
    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        Route::minion('rpc');

        parent::boot();
    }

    // ...
}

您还可以使用以下方法将其设置为特定域名:

Route::minion('/', 'rpc.your-domain');