PHPackages                             feicanfly/alipay - 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. [Payment Processing](/categories/payments)
4. /
5. feicanfly/alipay

ActiveLibrary[Payment Processing](/categories/payments)

feicanfly/alipay
================

支付宝SDK在Laravel5封装包。

1.0(9y ago)038MITPHPPHP &gt;=5.4.0

Since Aug 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/feicanfly/laravel-alipay)[ Packagist](https://packagist.org/packages/feicanfly/alipay)[ Docs](https://github.com/gaoxuxu123/laravel-alipay)[ RSS](/packages/feicanfly-alipay/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

\##安装

```
composer require laravel-alipay/alipay dev-master

或者在composer.json中加入

 "require": {

        "laravel-alipay/alipay": "dev-master"
}

```

更新依赖 `composer update`

\##使用说明

找到 `config/app.php` 文件

```
'providers' => [

   Lxu\Alipay\AlipayServiceProvider::class,
]

```

运行 `php artisan vendor:publish` 命令

配置文件 `config/lxu-alipay.php` 已经生成，按照要求配置即可

\##DEMO

\###PC网页支付

```
public function getPay(Request $request)
    {
        //唯一的订单号
        $out_trade_no       = '20160122';
        //订单名称
        $subject            = 'xxxxxxxxxxx';
        //付款金额
        $total_fee          = '0.01';
        //订单描述
        $body               = 'xxxxxxxxxxx';
        $show_url           = '';
        $anti_phishing_key  = '';
        $exter_invoke_ip    = $request->getClientIp();
        $parameter = [
                        "service"           => config('lxu-alipay.pcconfig.service'),
                        "partner"           => trim(config('lxu-alipay.pcconfig.partner')),
                        "seller_id"         => trim(config('lxu-alipay.mobileconfig.seller_id')),
                        "payment_type"      => config('lxu-alipay.pcconfig.payment_type'),
                        "notify_url"        => config('lxu-alipay.pcconfig.notify_url'),
                        "return_url"        => config('lxu-alipay.pcconfig.return_url'),
                        "seller_email"      => config('lxu-alipay.pcconfig.seller_email'),
                        "out_trade_no"      => $out_trade_no,
                        "subject"           => $subject,
                        "total_fee"         => $total_fee,
                        "body"              => $body,
                        "show_url"          => $show_url,
                        "anti_phishing_key" => $anti_phishing_key,
                        "exter_invoke_ip"   => $exter_invoke_ip,
                        "_input_charset"    => trim(strtolower(config('lxu-alipay.pcconfig.input_charset')))
                    ];
        $pc =  app('PcAlipay');
        $html_text = $pc->buildRequestForm($parameter,"post", "确认");
        echo $html_text;

        }
     /**
         * 支付宝服务器异步通知
         * @param $request
         * @return mixed
         */
        public function getNotifyurl(Request $request)
        {
            $alipayNotify  = app('PcAlipay');
            $verify_result = $alipayNotify->verifyNotify();
            if($verify_result){
                //验证成功
                //获取支付宝的通知返回参数
            $parameter = [
                        "out_trade_no"      => $request->out_trade_no, //商户订单编号；
                        "trade_no"          => $request->trade_no,     //支付宝交易号；
                        "total_fee"         => $request->total_fee,    //交易金额；
                        "trade_status"      => $request->trade_status, //交易状态
                        "notify_id"         => $request->notify_id,    //通知校验ID。
                        "notify_time"       => $request->notify_time,  //通知的发送时间。格式为yyyy-MM-dd HH:mm:ss。
                        "buyer_email"       => $request->buyer_email,  //买家支付宝帐号；
                         ];
                if($request->trade_status == 'TRADE_FINISHED') {
                        //

                }else if ($request->trade_status == 'TRADE_SUCCESS') {

                        //进行订单处理，并传送从支付宝返回的参数；
                        //检查是否已经支付
                        //checkorderstatus($request->out_trade_no);
                        //修改支付状态
                        //orderHandle($parameter);
                }
                //请不要修改或删除
                echo "success";
            }else {
                //验证失败
                echo "fail";
            }
        }
        /**
         * 支付宝页面跳转同步通知
         * @param $request
         * @return mixed
         */
        public function getReturnurl(Request $request)
        {
            $alipayNotify   = app('PcAlipay');
            $verify_result  = $alipayNotify->verifyReturn();
            if($verify_result){

            $parameter = [
                        "out_trade_no"      => $request->out_trade_no, //商户订单编号；
                        "trade_no"          => $request->trade_no,     //支付宝交易号；
                        "total_fee"         => $request->total_fee,    //交易金额；
                        "trade_status"      => $request->trade_status, //交易状态
                        "notify_id"         => $request->notify_id,    //通知校验ID。
                        "notify_time"       => $request->notify_time,  //通知的发送时间。格式为yyyy-MM-dd HH:mm:ss。
                        "buyer_email"       => $request->buyer_email,  //买家支付宝帐号；
                        ];
                if($request->trade_status == 'TRADE_FINISHED' || $request->trade_status == 'TRADE_SUCCESS') {
                    //支付成功
                    //处理订单状态，记录支付记录
                    //检查是否已经支付
                    //checkorderstatus($request->out_trade_no);
                    //修改支付状态
                    //orderHandle($parameter);
                    //跳转支付成功界面
                    return view('');
                }else{

                    //跳转支付失败界面
                    return view('');
                }
            }else{
                 //echo '支付失败!';
                return view('');
            }
        }

```

\###手机网页支付

```
首先下载 Openssl工具，windows开发者下载链接: http://download.csdn.net/detail/gaoxuaiguoyi/9443275

Linux开发者直接去官网下载openssl.org

解压之后按照:

https://doc.open.alipay.com/doc2/detail.htm?spm=0.0.0.0.y0P2mJ&treeId=58&articleId=103242&docType=1

教程即可生成 rsa_private_key.pem和rsa_public_key.pem  2个文件覆盖项目中的key文件夹下载文件即可。

```

\##待续

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3620d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3324dc80ee5237cc96f9b31fb652f26e8ccaaa1ef3aca524e16ae393f1e2b7f?d=identicon)[feicanfly](/maintainers/feicanfly)

---

Top Contributors

[![gaoxuxu123](https://avatars.githubusercontent.com/u/11934791?v=4)](https://github.com/gaoxuxu123 "gaoxuxu123 (28 commits)")

---

Tags

laravellaravel 5alipayAlipay SDK

### Embed Badge

![Health badge](/badges/feicanfly-alipay/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M123](/packages/laravel-pulse)[latrell/alipay

支付宝SDK在Laravel5封装包。

40349.2k](/packages/latrell-alipay)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9772.3M122](/packages/roots-acorn)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4849.3k](/packages/sebdesign-laravel-viva-payments)

PHPackages © 2026

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