承接 maksimovic/slim-oauth2-middleware 相关项目开发

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

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

maksimovic/slim-oauth2-middleware

Composer 安装命令:

composer require maksimovic/slim-oauth2-middleware

包简介

OAuth2 middleware for use within a Slim Framework API

README 文档

README

Fork Notice: This is a maintained fork of the abandoned chadicus/slim-oauth2-middleware package. Updated for PHP 8.1+ and PSR-15.

License

PSR-15 middleware for using OAuth2 Server within any PSR-15 compatible framework, including Slim 4.

Requirements

PHP 8.1 or later.

Installation

composer require maksimovic/slim-oauth2-middleware

Example usage

use Chadicus\Slim\OAuth2\Middleware\Authorization;
use OAuth2;
use OAuth2\Storage;
use OAuth2\GrantType;

$storage = new Storage\Memory([
    'client_credentials' => [
        'administrator' => ['client_id' => 'administrator', 'client_secret' => 'password', 'scope' => 'superUser'],
    ],
]);

$server = new OAuth2\Server(
    $storage,
    ['access_lifetime' => 3600],
    [new GrantType\ClientCredentials($storage)]
);

$auth = new Authorization($server, $container);

// Slim 4
$app->get('/foos', $handler)->add($auth);
$app->post('/foos', $handler)->add($auth->withRequiredScope(['superUser']));

$container must be either an ArrayAccess or expose a set($key, $value) method (e.g. PHP-DI). The decoded access token is stored under the 'token' key on success and added to the request as the oauth2-token attribute.

Development

composer install
composer test
composer test:coverage
composer cs-check

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固