MyController / alipay-easysdk-laravel by MyController

基于 alipay/alipay-easysdk 的 Laravel/Lumen 框架扩展
8
0
2
Package Data
Maintainer Username: MyController
Maintainer Contact: mycontroller@163.com (MyController)
Package Create Date: 2022-01-05
Package Last Update: 2022-01-07
Language: PHP
License: MIT
Last Refreshed: 2024-11-18 03:00:44
Package Statistics
Total Downloads: 8
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

alipay-easysdk-laravel

基于 alipay/alipay-easysdk 的 Laravel/Lumen 框架扩展

安装

composer require mycontroller/alipay-easysdk-laravel

配置

Laravel

在文件 config/app.php 中添加:

    'providers' => [
        // ...
        MyController\AlipayEasySDK\AlipayEasySDKServiceProvider::class,
    ],

    'aliases' => [
        // ...
        'AlipayEasySDKFactory' => MyController\AlipayEasySDK\Facades\AlipayEasySDKFactory::class,
    ],

运行 php artisan vendor:publish --tag=alipay-easysdk 命令,发布配置文件到你的项目中。

Lumen

在文件 bootstrap/app.php 里添加:

$app->withFacades(true, [
    // ...
    MyController\AlipayEasySDK\Facades\AlipayEasySDKFactory::class => 'AlipayEasySDKFactory',
]);

//Register Service Providers
// ...
$app->register(MyController\AlipayEasySDK\AlipayEasySDKServiceProvider::class);
// ...

//Loading configure
// ...
$app->configure('alipay-easysdk');
// ...

/config/ 目录下的配置文件拷贝到项目的 /config/ 目录里

alipay-easysdk.php                  ===>   alipay-easysdk.php
alipay-easysdk-key/private_key.pem  ===>   alipay-easysdk-key/private_key.pem
alipay-easysdk-key/public_key.pem   ===>   alipay-easysdk-key/public_key.pem

使用

可以通过门面 AlipayEasySDKFactory 或者 app('alipay-easysdk-factory') 使用,

具体用法需要去看 alipay/alipay-easysdk