carry0987/falcon 问题修复 & 功能扩展

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

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

carry0987/falcon

Composer 安装命令:

composer require carry0987/falcon

包简介

Falcon - A versatile PHP framework designed for seamless integration of third-party social logins. Supports major services including Google, Facebook, Twitter, etc, delivering simple and secure authentication via a unified interface and design patterns.

README 文档

README

Packgist
Falcon is a versatile PHP framework designed for seamless integration of third-party social platform login mechanisms.
It offers simple and secure user authentication through a unified interface and design patterns, making it easy to implement and maintain.
Currently, it supports the following major services:

  • GitHub
  • Google
  • Facebook
  • Instagram
  • Twitter
  • Reddit
  • Discord
  • Line
  • Telegram

Whether you're developing a new application or enhancing an existing system, Falcon can help you quickly implement social login features while ensuring user data security and privacy.

Features

  • Unified Interface: Operate all supported social services using standardized methods.
  • Easy Integration: Integrate quickly into your project with intuitive configuration and clear documentation.
  • Security: Implements the best current security practices to safeguard the login process and data.
  • Flexible Design: Easily add or remove specific social services without affecting the existing system architecture.
  • Open Source Support: Benefit from the continuous improvements and support of the open-source community.

Installation

Install Falcon into your project with Composer:

composer require carry0987/falcon

Usage Example

First, set up the credentials and other configuration information for each third-party service in your project:

$config = [
    'providers' => [
        'github' => [
            'client_id' => 'your_github_client_id',
            'client_secret' => 'your_github_client_secret',
            'redirect_uri' => 'https://your-website.com/path/to/callback.php?provider=github'
        ],
        'line' => [
            'client_id' => 'your_line_client_id', // Channel ID
            'client_secret' => 'your_line_client_secret', // Channel secret
            'redirect_uri' => 'https://your-website.com/path/to/callback.php?provider=line'
        ],
        'telegram' => [
            'client_id' => 'your_telegram_client_id', // Bot username
            'client_secret' => 'your_telegram_client_secret', // Bot token
            'redirect_uri' => 'https://your-website.com/path/to/callback.php?provider=telegram'
        ],
        // Configuration for other third-party login providers...
    ],
];

Next, create an instance of Falcon and initiate the login process with the chosen third-party provider:

$falcon = new \carry0987\Falcon\Falcon($config);
$providerName = $_GET['provider'] ?? 'default';
$provider = $falcon->createProvider($providerName);

// Start the OAuth login process
if (!isset($_GET['code'])) {
    $loginUrl = $provider->authorize();
    // Redirect user to the login page
    header('Location: ' . $loginUrl);
    exit;
}

// Handle the callback and retrieve user information
if ($providerName === 'telegram') {
    // Special handling for Telegram login flow...
} else {
    $accessToken = $provider->getTokenWithAuthCode($_GET['code']);
    $user = $provider->getUser();
    
    // Output user information
    echo "<pre>" . print_r($user, true) . "</pre>";
}

To end the login session, you can revoke the access token:

if (isset($_GET['logout'])) {
    $provider->revokeAccessToken($_GET['access_token'] ?? null);
    // Redirect back to the login page or homepage
    header('Location: ?provider=' . $providerName);
    exit;
}

You can add more standard OAuth processing logic to your code, such as handling error states, redirecting to other pages, etc.

Support

If you have any issues, please open an issue on our GitHub repository.

Enjoy using Falcon in your project!

carry0987/falcon 适用场景与选型建议

carry0987/falcon 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 80 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 carry0987/falcon 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 carry0987/falcon 我们能提供哪些服务?
定制开发 / 二次开发

基于 carry0987/falcon 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-30