PHPackages                             hedeqiang/alchemypay - 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. hedeqiang/alchemypay

ActiveLibrary

hedeqiang/alchemypay
====================

AlchemyPay SDK for PHP

v1.0.0(3y ago)27MITPHPPHP &gt;=7.1

Since Oct 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hedeqiang/alchemypay-sdk-php)[ Packagist](https://packagist.org/packages/hedeqiang/alchemypay)[ RSS](/packages/hedeqiang-alchemypay/feed)WikiDiscussions main Synced 1mo ago

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

AlchemyPay SDK for PHP
======================

[](#alchemypay-sdk-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/82139fe78e2676c2132f40797fa20ab31aa16ea5125f806c438a990da3c7a8ea/687474703a2f2f706f7365722e707567782e6f72672f686564657169616e672f616c6368656d797061792f76)](https://packagist.org/packages/hedeqiang/alchemypay) [![Total Downloads](https://camo.githubusercontent.com/b2b33909e0d9210f17476b5a1cf34dc387ca3e87d2bf9f7956b485e76b64985e/687474703a2f2f706f7365722e707567782e6f72672f686564657169616e672f616c6368656d797061792f646f776e6c6f616473)](https://packagist.org/packages/hedeqiang/alchemypay) [![Latest Unstable Version](https://camo.githubusercontent.com/98c4c4803bb346cd17240a6afbc4ce5d1b35743a765f2923dd6f53f0553b1b36/687474703a2f2f706f7365722e707567782e6f72672f686564657169616e672f616c6368656d797061792f762f756e737461626c65)](https://packagist.org/packages/hedeqiang/alchemypay) [![License](https://camo.githubusercontent.com/6158a0be177b5815d3300b5b0d76dc363774c5639fcb1432fc2639b1570a60c9/687474703a2f2f706f7365722e707567782e6f72672f686564657169616e672f616c6368656d797061792f6c6963656e7365)](https://packagist.org/packages/hedeqiang/alchemypay) [![PHP Version Require](https://camo.githubusercontent.com/1d12e0b80f5de620a4180f61cfdd4c75b006c9907aa190034337c3192649fcb6/687474703a2f2f706f7365722e707567782e6f72672f686564657169616e672f616c6368656d797061792f726571756972652f706870)](https://packagist.org/packages/hedeqiang/alchemypay)[![Tests](https://github.com/hedeqiang/alchemypay-sdk-php/actions/workflows/test.yml/badge.svg)](https://github.com/hedeqiang/payease/actions/workflows/test.yml)

环境需求
----

[](#环境需求)

- PHP &gt;= 7.1
- [Composer](https://getcomposer.org/) &gt;= 2.0

支持主流框架 `Laravel`、`Hyperf`、`Yii2` 快捷使用，具体使用方法请滑到底部

Installing
----------

[](#installing)

```
$ composer require hedeqiang/alchemypay -vvv
```

Usage
-----

[](#usage)

```
require __DIR__ .'/vendor/autoload.php';
use Hedeqiang\AlchemyPay\Pay;
$app = new Pay([
    'endpoint'     => 'xxx',
    'merchantCode' => 'xxx',
    'privateKey' => 'xxx',
]);
```

### 创建订单

[](#创建订单)

```
$uri = 'openApi/createOrder';

$params = [
    "amount"           => "10.0",
    "fiatType"         => "CNY",
    "callbackUrl"      => "http://147.243.170.11:9091/transnotify",
    "merchantOrderNum" => "testqwe1234567891035",
    "payMent"          => "w1",
    "email"            => "123456@qq.com",
];

$response = $app->request($uri,$params);
```

### 回调通知

[](#回调通知)

```
$result = $app->handleNotify();
// TODO

return 'SUCCESS' ; // retuen 'Fail';
```

在 Laravel 中使用
-------------

[](#在-laravel-中使用)

#### 发布配置文件

[](#发布配置文件)

```
php artisan vendor:publish --tag=alchemy
or
php artisan vendor:publish --provider="Hedeqiang\AlchemyPay\ServiceProvider"
```

##### 编写 .env 文件

[](#编写-env-文件)

```
ALCHEMY_PAY_ENDPOINT=
ALCHEMY_PAY_MERCHANT_CODE=
ALCHEMY_PAY_PRIVATE_KEY=

```

### 使用

[](#使用)

#### 服务名访问

[](#服务名访问)

```
public function index()
{
    return app('pay')->request($uri,$params);
}
```

#### Facades 门面使用(可以提示)

[](#facades-门面使用可以提示)

```
use Hedeqiang\AlchemyPay\Facades\Pay;

public function index()
{
   return Pay::pay()->request($uri,$params)
}

public function notify(Request $request)
{
   $result = Pay::pay()->handleNotify();
}
```

在 Hyperf 中使用
------------

[](#在-hyperf-中使用)

#### 发布配置文件

[](#发布配置文件-1)

```
php bin/hyperf.php vendor:publish hedeqiang/alchemypay
```

##### 编写 .env 文件

[](#编写-env-文件-1)

```
ALCHEMY_PAY_ENDPOINT=
ALCHEMY_PAY_MERCHANT_CODE=
ALCHEMY_PAY_PRIVATE_KEY=

```

#### 使用

[](#使用-1)

```
get(Pay::class)->request($uri,$parmas);

// 回调
$response = ApplicationContext::getContainer()->get(Pay::class)->handleNotify();
```

在 Yii2 中使用
----------

[](#在-yii2-中使用)

#### 配置

[](#配置)

在 `Yii2` 配置文件 `config/main.php` 的 `components` 中添加:

```
'components' => [
    // ...
    'pay' => [
        'class' => 'Hedeqiang\AlchemyPay\YiiPay',
        'options' => [
            'endpoint'     => 'xxx',
            'merchantCode' => 'xxx',
            'privateKey' => 'xxx',
        ],
    ],
    // ...
]
```

#### 使用

[](#使用-2)

```
Yii::$app->response->format = Response::FORMAT_JSON;

// 请求
$results = Yii::$app->pay->getPay()->request($uri,$params);
// 回调
$results = Yii::$app->pay->getPay()->handleNotify();
```

Project supported by JetBrains
------------------------------

[](#project-supported-by-jetbrains)

Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.

[![](https://camo.githubusercontent.com/3cf726e7cdadba47755b7f7ea4227945a92a2fa48aadf4a2573140ec6501c989/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a625f6265616d2e737667)](https://www.jetbrains.com/?from=https://github.com/hedeqiang)

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/hedeqiang/alchemypay-sdk-php/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/hedeqiang/alchemypay-sdk-php/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

1294d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ac33cc87fe5ba7f0b8791f5b3453501e83b55ec9a5a209728817ff119635a72?d=identicon)[hedeqiang](/maintainers/hedeqiang)

---

Top Contributors

[![hedeqiang](https://avatars.githubusercontent.com/u/31909061?v=4)](https://github.com/hedeqiang "hedeqiang (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hedeqiang-alchemypay/health.svg)

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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