PHPackages                             timeshow/ucenter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. timeshow/ucenter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

timeshow/ucenter
================

timeshow ucenter package for the laravel with php

v0.6.8(5y ago)3341[1 issues](https://github.com/timeshow/ucenter/issues)MITPHPPHP &gt;=5.6

Since May 12Pushed 5y ago2 watchersCompare

[ Source](https://github.com/timeshow/ucenter)[ Packagist](https://packagist.org/packages/timeshow/ucenter)[ RSS](/packages/timeshow-ucenter/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (20)Used By (0)

Ucenter Client For The Laravel
------------------------------

[](#ucenter-client-for-the-laravel)

### 说明

[](#说明)

本项目在参考了多个相关类似项目的基础上修改调整。 官方UCenter 1.6.0 版本不存在手机号码、用户标识等字段， 使用官方安装包请获取V0.5.6版本， 使用`composer require timeshow/ucenter "0.5.6"`安装扩展包 从V0.6.0版本开始新增手机号、用户标识、父类ID等字段，需在数据表`members`中添加`mobile,UnionID,parent_id`相关字段

### 安装

[](#安装)

- [Packagist](https://packagist.org/packages/timeshow/ucenter)
- [GitHub](https://github.com/timeshow/ucenter)

只要在你的 `composer.json` 文件require中加入下面内容，就能获得最新版.

```
"timeshow/ucenter": "dev-master"

```

然后需要运行 "composer update" 来更新你的项目

或运行

```
composer require timeshow/ucenter

```

安装完后，在 `config/app.php` 文件中找到 `providers` 键，

```
'providers' => [

    TimeShow\UCenter\UCenterServiceProvider::class

]

```

找到 `aliases` 键，

```
'aliases' => [

    'UCenter' => TimeShow\UCenter\UCenterServiceProvider::class

]

```

配置
--

[](#配置)

运行以下命令发布配置文件

```
php artisan vendor:publish  --provider="TimeShow\UCenter\UCenterServiceProvider"

```

ucenter配置项

```
//config.php
'url'		=> '', // 网站UCenter接收数据的Api地址前缀，一般默认留空。
'connect'	=> 'mysql', // 连接 UCenter 的方式: mysql/NULL, 默认为空时为 fscoketopen()
'dbhost'	=> 'localhost', // UCenter 数据库主机
'dbuser'	=> 'root', // UCenter 数据库用户名
'dbpw'		=> 'root', // UCenter 数据库密码
'dbname'	=> 'ucenter', // UCenter 数据库名称
'dbcharset'	=> 'utf8',// UCenter 数据库字符集
'dbtablepre'=> '`uc`.uc_', // UCenter 数据库表前缀
'key'		=> '666cLXgFsrl6TcvDflhrvdcziY8SnhP1eexl1eQ', // 与 UCenter 的通信密钥, 要与 UCenter 保持一致
'charset'	=> 'utf-8', // UCenter 的字符集

'api'		=> 'http://localhost/ucenter', // UCenter 的 URL 地址, 在调用头像时依赖此常量
'ip'		=> '127.0.0.1', // UCenter 的 IP, 当 UC_CONNECT 为非 mysql 方式时, 并且当前应用服务器解析域名有问题时, 请设置此值
'appid'		=> 1, //当前应用的 ID
'ppp'		=> 20, //当前应用的 ID

'apifilename'    => env('UC_APIFILENAME', 'uc'),   //这里是uc_server调用你的程序的接口，配置成uc的话，将会和前面的UC_URL配置一起形成这样的地址 url/api/uc
'service'        => env('UC_SERVICE', 'TimeShow\UCenter\Services\Api'),   //这里如果要异步登陆，可以直接继承这个类实现其中的方法，也可以创建app/Service/UCenter.php(文件放哪里都可以，这里只是推荐) 实现该类实现的接口【*】

```

环境变量
----

[](#环境变量)

在 `.env` 环境变量中配置:

```
UC_CONNECT=mysql
UC_DBHOST=localhost
UC_DBUSER=root
UC_DBPW=root
UC_DBNAME=ucenter
UC_DBTABLEPRE=`ucenter`.uc_
UC_KEY=123456789
UC_API=http://localhost/uc_server
UC_IP=127.0.0.1
UC_APPID=1

UC_APIFILENAME=uc

```

把配置项添加到 .env 文件底部

路由
--

[](#路由)

在`routes/web.php`中写入:

```
use TimeShow\UCenter\Facades\UCenter;
UCenter::routes();

```

这个会添加一个api地址，用于同步登陆和退出

使用
--

[](#使用)

例如：获取用户名为test的信息

```
$result = UCenter::uc_get_user('test');
var_dump($result);

```

更多函数请参考 [Ucenter 文档](http://faq.comsenz.com/library/UCenter/interface/interface_user.htm)或 [Github 参考文档](https://github.com/timeshow/ucenter/tree/master/doc)

帮助
--

[](#帮助)

1、ucenter 在PHP 7以上版本出现错误

```
修正不兼容php7+，mysql_connect()不可用等问题
使用 mysqli_connect 方式连接

```

2、UCenter 后台应用管理列表通信失败问题

```
一、查看以上配置是否正确
二、在 routes/web.php 中修改
//$result = UCenter::uc_get_user('test');
//var_dump($result);

```

联系我
---

[](#联系我)

有问题，请提交issue

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~3 days

Recently: every ~11 days

Total

19

Last Release

2185d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57834562?v=4)[timeshow](/maintainers/timeshow)[@timeshow](https://github.com/timeshow)

---

Top Contributors

[![timeshow](https://avatars.githubusercontent.com/u/57834562?v=4)](https://github.com/timeshow "timeshow (38 commits)")

### Embed Badge

![Health badge](/badges/timeshow-ucenter/health.svg)

```
[![Health](https://phpackages.com/badges/timeshow-ucenter/health.svg)](https://phpackages.com/packages/timeshow-ucenter)
```

###  Alternatives

[fbf/laravel-comments

A Laravel 4 package for adding commenting to a website that has user accounts

214.6k](/packages/fbf-laravel-comments)

PHPackages © 2026

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