tykfyr/openid-connect-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tykfyr/openid-connect-php

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tykfyr/openid-connect-php

包简介

A simple OpenID Connect client library for PHP

README 文档

README

A simple OpenID Connect client library for PHP that makes it easy to integrate OpenID Connect authentication into your PHP applications.

Requirements

  • PHP 7.4 or higher
  • cURL extension
  • JSON extension

Installation

composer require tykfyr/openid-connect-php

Usage

Basic Authentication Flow

use Tykfyr\OpenIDConnect\Client;

// Initialize the client
$oidc = new Client(
    'https://your-identity-provider.com',
    'your-client-id',
    'your-client-secret'
);

// Set the redirect URI
$oidc->setRedirectUri('https://your-app.com/callback');

// Start authentication
$oidc->authenticate();

// In your callback handler
$oidc->handleCallback();

// Get user information
$userInfo = $oidc->requestUserInfo();
$email = $oidc->requestUserInfo('email');

Advanced Configuration

// Configure SSL verification
$oidc->setVerifyHost(false); // Disable host verification (not recommended for production)
$oidc->setVerifyPeer(false); // Disable peer verification (not recommended for production)

// Set custom certificate path
$oidc->setCertPath('/path/to/cert.pem');

// Configure proxy
$oidc->setHttpProxy('http://proxy.example.com:8080');

// Set custom scopes
$oidc->setScopes(['openid', 'profile', 'email', 'custom_scope']);

Features

  • Full OpenID Connect authentication flow
  • Automatic discovery of provider configuration
  • JWT token validation
  • User info endpoint support
  • Configurable SSL verification
  • Proxy support
  • Custom scopes support

Security Considerations

  • Always use HTTPS in production
  • Keep your client secret secure
  • Validate the state parameter
  • Verify the ID token
  • Use appropriate scopes for your needs

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固