PHPackages                             buerxiaojie/laravel-oauth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. buerxiaojie/laravel-oauth

ActiveLibrary

buerxiaojie/laravel-oauth
=========================

oauth for laravel. for example, QQ, wechat, github..

1.1.2(8y ago)2320MITPHPPHP &gt;=5.5

Since Jul 19Pushed 8y agoCompare

[ Source](https://github.com/buer0/laravel-oauth)[ Packagist](https://packagist.org/packages/buerxiaojie/laravel-oauth)[ RSS](/packages/buerxiaojie-laravel-oauth/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

oauth for laravel
=================

[](#oauth-for-laravel)

（一）安装
=====

[](#一安装)

### 1. 安装：

[](#1-安装)

```
composer require buerxiaojie/laravel-oauth
```

### 2. 注册：

[](#2-注册)

在 `config/app.php` 文件的 `providers` 数组中加入：

```
  Buerxiaojie\Providers\OauthServiceProvider::class,
```

在 `config/app.php` 文件的 `aliases` 数组中加入：

```
  'OauthUser' => Buerxiaojie\Facades\Oauth::class,
```

在 `app/Providers/AuthServiceProvider.php` 文件的 `boot` 方法中加入：

```
	use Buerxiaojie\Oauth;

	Oauth::routes();
```

### 3. 生成配置文件：

[](#3-生成配置文件)

```
  php artisan vendor:publish
```

（二）配置
-----

[](#二配置)

在 `config/oauth.php` 文件中配置以下：

```
  /**
   * 加入以下
   *
   */

  	'qq' => [
		'app_id' => 'YOUR APP ID',
		'app_secret' => 'YOUR APP SECRET',
	],
	'wechat' => [
		'app_id' => 'YOUR APP ID',
		'app_secret' => 'YOUR APP SECRET'
	]

```

（三）使用
-----

[](#三使用)

### 1. 在QQ ，微信等平台注册账号，并将回掉地址修改为`{YOUR HOST}/oauth/oauth-callback`：

[](#1-在qq-微信等平台注册账号并将回掉地址修改为your-hostoauthoauth-callback)

### 2. 在`app/Oauth/Hander.php`文件的`handle`方法中进行获取用户信息之后的逻辑处理：

[](#2-在appoauthhanderphp文件的handle方法中进行获取用户信息之后的逻辑处理)

```
	/**
	*业务处理
	*/
	public function handle()
	{
		//$oauthUser 即为获取的用户信息
		$oauthUser = OauthUser::userInfo();

		/**
		*业务处理
		*/
	}
```

### 3. 添加新的`server`。

[](#3-添加新的server)

#### 1. 运行一下命令生成`server`类

[](#1-运行一下命令生成server类)

```
	php artisan make:oauthServer Github
```

`app/Oauth/Servers/Github.php`即可生成。填充相应的方法即可。

#### 2. 在 `config/oauth.php` 文件中配置以下：

[](#2-在-configoauthphp-文件中配置以下)

```
  /**
   * 加入以下
   *
   */
   'servers' => [
		'github' => 'App\Oauth\Servers\Github',
	],

  'github' => [
		'app_id' => 'YOUR APP ID',
		'app_secret' => 'YOUR APP SECRET',
	]

```

#### 3. 在页面中放置请求链接：

[](#3-在页面中放置请求链接)

```

```

#### 4. 若自定义回掉地址，则在对应的回掉方法中通过以下方法获取用户信息：

[](#4-若自定义回掉地址则在对应的回掉方法中通过以下方法获取用户信息)

```
	use OauthUser;

	public function oauthCallback(Request $request)
	{
		$userInfo = OauthUser::getUserInfo($request);

		/**
		* 其他业务逻辑
		*/
	}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Total

2

Last Release

3193d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d565ef898393e7f5398b0902f79a03c48990dd0bb3ef193d007dda6e4090348?d=identicon)[buer](/maintainers/buer)

### Embed Badge

![Health badge](/badges/buerxiaojie-laravel-oauth/health.svg)

```
[![Health](https://phpackages.com/badges/buerxiaojie-laravel-oauth/health.svg)](https://phpackages.com/packages/buerxiaojie-laravel-oauth)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
