PHPackages                             yangliuxin/utils - 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. yangliuxin/utils

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

yangliuxin/utils
================

utils

v1.0.5(1y ago)0671MITPHPPHP &gt;=8.0

Since May 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yangliuxin/utils)[ Packagist](https://packagist.org/packages/yangliuxin/utils)[ RSS](/packages/yangliuxin-utils/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (6)Used By (1)

utils
=====

[](#utils)

### WeChat Callback Controller

[](#wechat-callback-controller)

```
public function paymentNotify()
{
    $request = $this->request->all();
    $app = new Application(config('wechat.payment'));
    try {
        $server = $app->getServer();
        $message = $server->getRequestMessage($request);
        $out_trade_no = $message['out_trade_no']; // 商户订单号
        $order = Orders::getOrderInfoByOutTradeNo($out_trade_no);
        if (empty($order)) {
            return true;
        }
        if ($message['trade_state'] === 'SUCCESS') { // return_code 表示通信状态，不代表支付状态
            //加入自己支付完成后该做的事
            Orders::setOrderStatus($order['id'], Orders::STATUS_PAYED);
            Orders::where('id',$order['id'])->update(['pay_at'=> date("Y-m-d H:i:s")]);
            //给卖主发通知发货
            foreach ($order['goods'] as $key => $val){
                //作品状态置为已售
                Product::where('id',$val['good_id'])->update(['status' => Product::STATUS_SOLD, 'is_recommend' => 0, 'is_discount' => 0]);
            }

        }
        return true;
    } catch (InvalidArgumentException|\ReflectionException|\Throwable $e) {
        return false;
    }
}

public function paymentRefundNotify()
{
    $request = $this->request->all();
    Log::get()->info('WECHAT_REFUND_NOTIFY_DATA_REQUEST', $request);
    $app = new Application(config('wechat.payment'));
    try {
        $server = $app->getServer();
        $message = $server->getRequestMessage($request);
        $out_refund_no = $message['out_refund_no']; // 商户订单号
        $order = Orders::getOrderInfoByOutRefundNo($out_refund_no);
        if (empty($order)) {
            return true;
        }
        if ($message['refund_status'] === 'SUCCESS') { // return_code 表示通信状态，不代表支付状态
            //加入自己支付完成后该做的事
            Orders::setOrderStatus($order['id'], Orders::STATUS_CANCEL);
            Orders::where('id',$order['id'])->update(['refund_at' =>  date("Y-m-d H:i:s")]);
            $this->queueService->push(['type' => 'Notification',  'class' => 'OrderRefundNotification', 'from' => 0, 'to' => $order['uid'], 'data' => [$order['order_id']]]);
            //给卖主发通知发货
            foreach ($order['goods'] as $key => $val){
                //作品状态置为已售
                Product::where('id',$val['good_id'])->update(['status' => Product::STATUS_DEFAULT, 'is_recommend' => 1, 'is_discount' => 1]);
            }

        }
        return true;
    } catch (InvalidArgumentException|\ReflectionException|\Throwable $e) {
        Log::get()->info('PAY_REFUND_NOTIFY_DATA_EXCEPTION',[ $e->getMessage()]);
        return false;
    }
}

```

### Patch

[](#patch)

```
### php文件代码

! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__.'/../', 1));
spl_autoload_register(function ($cls) {
$map = [
    'Hyperf\HttpServer\CoreMiddleware' => BASE_PATH . '/patch/CoreMiddleware.php',
];

if (isset($map[$cls])) {
    include $map[$cls];
    return true;
}
return true;
}, true, true);

### composer.json

"autoload": {
    "files": [
        "patch/autoload.php"
    ]
},

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity9

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

Total

5

Last Release

550d ago

### Community

Maintainers

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

---

Top Contributors

[![yangliuxin](https://avatars.githubusercontent.com/u/28886044?v=4)](https://github.com/yangliuxin "yangliuxin (7 commits)")

### Embed Badge

![Health badge](/badges/yangliuxin-utils/health.svg)

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M517](/packages/shopware-core)[roundcube/roundcubemail

The Roundcube Webmail suite

7.0k1.4k3](/packages/roundcube-roundcubemail)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[fschmtt/keycloak-rest-api-client-php

PHP client to interact with Keycloak's Admin REST API.

48100.6k2](/packages/fschmtt-keycloak-rest-api-client-php)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)

PHPackages © 2026

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