定制 programster/google-sso 二次开发

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

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

programster/google-sso

最新稳定版本:0.0.2

Composer 安装命令:

composer require programster/google-sso

包简介

Apackage for integrating with Google SSO

README 文档

README

A package to make it easy to use Google SSO (OAuth 2 / OIDC), without minimal bloat and lots of flexibility.

This package makes use of the PSR-17 and PSR-18 interfaces, so this package should be able to work with any existing mechanism you use to send messages. If you are not sure what this means, then we would recommend that you just install the guzzlehttp/guzzle package, and follow the example in the README. If you cannot use Guzzle for whatever reason, then slim/psr7 is a good alternative.

Please be aware that this package requires the use of the $_SESSION superglobal

Usage

Installation

Install this in your codebase with composer like so:

composer require programster/google-sso

Example Code

There is an example codebase on GitHub that demonstrates using this package. Also, the following code snippet creates a Google SSO client and sends the user to Google to login.

<?php

require_once(__DIR__ . "/../vendor/autoload.php");

$googleSso = new GoogleSsoClient(
    $myGoogleClientId,
    $myGoogleClientSecret,
    $myGoogleSsoCallbackUrl = "https://localhost",
    new \GuzzleHttp\Psr7\HttpFactory(),
    new \GuzzleHttp\Client(),
);

if (isset($_GET['code']))
{
    // we are likely handling a user redirecting back here from having logged in with google.
    $userData = $googleSso->handleGoogleSsoLogin();
    print "Hello {$userData->getFullName()} with email address {$userData->getEmail()}";
}
else
{
    $googleSso->sendUserToGoogleLogin();
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固