定制 yoctu/api-guardian 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

yoctu/api-guardian

最新稳定版本:v1.3.1

Composer 安装命令:

composer require yoctu/api-guardian

包简介

Protect your API with a token (objective-php)

README 文档

README

Build Status

Protect your pages with a token!

Prerequisites

You will need a project running Objective-PHP to use this package.

If you want to use the user token feauture, you'll need a user with the attribute apiToken With yoctu/connect you'll need at least connect-common v2.2.3

Installing

The package should be easy to install. You just need to add this repository to your composer.json

composer require yoctu/api-guardian

And add the package to your Application.php with filter(s) if needed.

$this->getStep('auth')
    ->plug(Apiguardian::class, new UrlFilter('/api/*'))->as('api-guardian')
;

Using the package

Now that the package has been plugged on your application you can setup the one or more token to be used in the configuration.

return [
    new Param('api-keys', ['api_key_one', 'api_key_two'])
];

You'll now need to add a token to your request to pass the middleware

GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: api_key_one
Connection: keep-alive

Running the tests

./vendor/bin/phpunit --bootstrap vendor/autoload.php tests

License

This project is licensed under the GNU GPL 3.0 License - see the LICENSE file for details

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2018-04-16