PHP code example of yansongda / hyperf-pay

1. Go to this page and download the library: Download yansongda/hyperf-pay library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yansongda / hyperf-pay example snippets




declare(strict_types=1);

namespace App\Controller;

use Yansongda\HyperfPay\Pay;
use Hyperf\HttpServer\Annotation\AutoController;

/**
 * @AutoController()
 */
class IndexController extends AbstractController
{
    public function index(Pay $pay)
    {
        return $pay->alipay()->web([
            'out_trade_no' => ''.time(),
            'total_amount' => '0.01',
            'subject' => 'yansongda 测试 - 1',
        ]);
    }
}

shell
php bin/hyperf.php vendor:publish yansongda/hyperf-pay