superzc/miniprogram

1.0.1 2023-12-14 09:10 UTC

This package is auto-updated.

Last update: 2024-11-18 03:56:44 UTC


README

Latest Version on Packagist Release Version

This package provides additional features to the Laravel framework.

Installation

You can install the package via composer:

composer require superzc/miniprogram

Usage

修改小程序配置文件config/miniprogram.php

return [
    'wechat' => [
        'appid' => 'xxx',
        'appsecret' => 'xxx',
    ],
];

调用类方法

use Superzc\Miniprogram\Miniprogram;
use Superzc\Miniprogram\Exceptions\DefaultException as MPDefaultException;

try {
    $miniprogram = new Miniprogram();
    $result = $miniprogram->doSomething();
} catch (MPDefaultException $e) {
    return response()->json([
        'ret' => $e->getCode(),
        'msg' => $e->getMessage(),
    ]);
}

使用门面

use Superzc\Miniprogram\Facades\Miniprogram;

try {
    $result = Miniprogram::doSomething();
} catch (MPDefaultException $e) {
    return response()->json([
        'ret' => $e->getCode(),
        'msg' => $e->getMessage(),
    ]);
}

Change log

暂无