midnite81/intercept

一组杂项的Laravel中间件

v1.0.3 2020-03-03 21:44 UTC

This package is auto-updated.

Last update: 2024-09-05 18:56:44 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

一些随机的中间件

安装

此包需要PHP 5.6+,并包含一个Laravel 5服务提供者。

要通过composer安装,请在您的composer.json中包含此包。

"midnite81/intercept": "0.0.*"

运行composer installcomposer update以下载依赖项,或者您可以运行composer require midnite81/intercept

Laravel 5集成

要使用此包与Laravel 5,首先将消息服务提供者添加到app/config/app.php中的服务提供者列表中。

'providers' => [
  Midnite81\Intercept\InterceptServiceProvider::class       
];

使用php artisan vendor:publish --provider="Midnite81\Intercept\InterceptServiceProvider"发布配置和迁移文件。

将以下内容添加到app\Http\Kernel.php

protected $routeMiddleware = [
    //...
    'isLocal' => \Midnite81\Intercept\Middleware\IsLocal::class,
    'noCache' => \Midnite81\Intercept\Middleware\NoCache::class,
    'noFacebook' => \Midnite81\Intercept\Middleware\NoFacebook::class,
    'homeIps' => \Midnite81\Intercept\Middleware\RestrictHomeIp::class,
    //...
];

配置文件

一旦您发布了配置文件,您将在config文件夹中找到一个名为Intercept.php的文件。您应该检查这些设置,并在必要时进行更新。