承接 gourmet/filters 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gourmet/filters

最新稳定版本:v1.0.0

Composer 安装命令:

composer require gourmet/filters

包简介

Dispatcher filters (middlewares) for CakePHP 3

README 文档

README

[Build Status](https://travis-ci.org/gourmet/filters [Total Downloads](https://packagist.org/packages/gourmet/filters License

Dispatcher filters (middlewares) for CakePHP 3.

NOTE: This is the master branch, latest stable is 1.0 branch.

Install

Using Composer:

composer require gourmet/filters:1.1.x-dev

You then need to load the plugin. In boostrap.php, something like:

\Cake\Core\Plugin::load('Gourmet/Filters');

Usage

All the below examples happen in bootstrap.php.

MaintenanceFilter

By default, this filter will look for the ROOT/maintenance.html file and if it exists, it will use it as the response.

DispatcherFactory::add('Gourmet/Filters.Maintenance');

You could customize the path like so:

DispatcherFactory::add('Gourmet/Filters.Maintenance', [
    'path' => '/absolute/path/to/maintenance/file.html'
]);

You could for example do echo 'Scheduled maintenance' > maintenance.html and your site will automatically be set to maintenance mode with the message 'Scheduled maintenance'.

IpFilter

Restrict access to spefic IPs and/or ban other.

DispatcherFactory::add('Gourmet/Filters.Ip', [
    'allow' => [
        '127.0.0.1'
    ]
]);

or

DispatcherFactory::add('Gourmet/Filters.Ip', [
    'disallow' => [
        '127.0.0.1'
    ]
]);

RobotsFilter

This one provides a default robots.txt file for non-production environments. By default, it checks the 'APP_ENV' environment variable and compares it's value to 'production'.

DispatcherFactory::add('Gourmet/Filters.Robots');

On all your non-production environments, robots.txt will look like this:

User-Agent: *
Disallow: /

and your pages' headers will include the X-Robots-Tag with 'noindex. nofollow, noarchive' flags.

You can customize all of that using the configuration keys: priority, when, key, value.

Patches & Features

  • Fork
  • Mod, fix
  • Test - this is important, so it's not unintentionally broken
  • Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
  • Pull request - bonus point for topic branches

Bugs & Feedback

http://github.com/gourmet/filters/issues

License

Copyright (c) 2015, Jad Bitar and licensed under The MIT License.

统计信息

  • 总下载量: 2.8k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固