PHPackages                             jncinet/qihucms-user-follow - 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. jncinet/qihucms-user-follow

ActiveLibrary

jncinet/qihucms-user-follow
===========================

qihucms user follow.

1.0.4(5y ago)06MITPHP

Since Dec 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jncinet/qihucms-user-follow)[ Packagist](https://packagist.org/packages/jncinet/qihucms-user-follow)[ Docs](https://www.qihucms.com)[ RSS](/packages/jncinet-qihucms-user-follow/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

安装
--

[](#安装)

```
$ composer require jncinet/qihucms-user-follow
```

使用
--

[](#使用)

### 数据迁移

[](#数据迁移)

```
$ php artisan migrate
```

### 发布资源

[](#发布资源)

```
$ php artisan vendor:publish --provider="Qihucms\UserFollow\FollowServiceProvider"
```

### 后台菜单

[](#后台菜单)

- 关注管理：user/follows

### 可用方法

[](#可用方法)

```
// 判断是否关注
app('user-follow')->isFollow(int $user_id, int $to_user_id);

// 创建关注关系
app('user-follow')->setFollow(int $user_id, int $to_user_id);

// 取消关注
app('user-follow')->unsetFollow(int $user_id, int $to_user_id);

// 互相关注
app('user-follow')->setEachOther(int $user_id, int $to_user_id);

// 取消相互关注
app('user-follow')->unsetEachOther(int $user_id, int $to_user_id);

// 会员关注分页列表
app('user-follow')->followPaginate(int $user_id, $status = null, $limit = 15);

// 会员粉丝分页
app('user-follow')->fansPaginate(int $user_id, $status = null, $limit = 15);
```

### 路由及参数说明

[](#路由及参数说明)

#### 关注列表、粉丝列表

[](#关注列表粉丝列表)

```
route('api.follow.index')
请求：GET
地址：/user/follows?user_id={$user_id}&type={$type}&status={$status}&page={$page}&limit={$limit}
参数：
int          $user_id （必填）需要查询的用户ID号
follow|fans  $type    （必填）查询类型：follow关注列表、fans粉丝列表
1|2          $status  （选填）如果只查询互相关注设置为2，默认为1查询所有关注
int          $page    （选填）页码
int          $limit   （选填）每页显示的条数
返回值：
{
    data: [
        {
            id：
            status：1｜2         // 1：关注 2：互相关注
            user: {会员信息},
            created_at: "3天前"  //关注时间
        },
        ...
    ],
    meta: {},
    links: {}
}

```

#### 添加关注

[](#添加关注)

```
route('api.follow.follow')
请求：POST
地址：/user/follow/{id=关注的用户ID号}
返回值：
{
    status: 'SUCCESS',
    result: {
        user_id: 关注的用户ID号
        to_user_id：被关注的用户ID号
        is_follow：是否关注
        is_fans：是否粉丝
    }
}
```

#### 查询是否关注

[](#查询是否关注)

```
route('api.follow.check')
请求：GET
地址：/user/follow/{$id=查询的用户ID号}
返回值：
{
    status: 'SUCCESS',
    result: {
        user_id: 关注的用户ID号
        to_user_id：被关注的用户ID号
        is_follow：是否关注
        is_fans：是否粉丝
    }
}
```

#### 批量关注

[](#批量关注)

```
route('api.follow.follows')
请求：POST
地址：/user/follows
参数：
array $ids （必填）需要关注的用户ID号组成的数组值如：[1,2,3,4]
返回值：
{
    status: 'SUCCESS',
    data: {
        1: {
            user_id: 关注的用户ID号
            to_user_id：被关注的用户ID号
            is_follow：是否关注
            is_fans：是否粉丝
        }
        2: false
        ...
    }
}
```

#### 取消关注

[](#取消关注)

```
route('api.follow.unfollow')
请求：DELETE
地址：/user/unfollow/{id=取消关注的会员ID}
返回值：
{
    status: 'SUCCESS',
    result: {
        user_id: 关注的用户ID号
        to_user_id：被关注的用户ID号
        is_follow：是否关注
        is_fans：是否粉丝
    }
}
```

### 事件调用

[](#事件调用)

```
// 添加关注
Qihucms\UserFollow\Events\Followed
// 取消关注
Qihucms\UserFollow\Events\UnFollowed
```

数据库
---

[](#数据库)

### 标签表：user\_follows

[](#标签表user_follows)

FieldTypeLengthAllowNullDefaultCommentidbigintuser\_idbigint会员IDto\_user\_idbigint关注会员IDstatustinyint1关注状态created\_attimestampYNULL创建时间updated\_attimestampYNULL更新时间

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

1960d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/63541651e21494722aa0d364dca6dbaa132d0ee4e9f85a741b5eff8c587f57ba?d=identicon)[jncinet](/maintainers/jncinet)

---

Tags

Followqihucms

### Embed Badge

![Health badge](/badges/jncinet-qihucms-user-follow/health.svg)

```
[![Health](https://phpackages.com/badges/jncinet-qihucms-user-follow/health.svg)](https://phpackages.com/packages/jncinet-qihucms-user-follow)
```

###  Alternatives

[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[christiankuri/laravel-favorite

Allows Laravel Eloquent models to implement a 'favorite' or 'remember' or 'follow' feature.

226471.2k5](/packages/christiankuri-laravel-favorite)[hypefactors/laravel-follow

Laravel 9 Follow System for Eloquent models.

4918.7k](/packages/hypefactors-laravel-follow)

PHPackages © 2026

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