PHPackages                             matperez/yii2-platron - 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. matperez/yii2-platron

ActiveYii2-extension[Payment Processing](/categories/payments)

matperez/yii2-platron
=====================

Yii2 Platron payment gateway API

0.3.0(9y ago)07.7k↓33.3%MITPHPPHP &gt;=5.5

Since Oct 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/matperez/yii2-platron)[ Packagist](https://packagist.org/packages/matperez/yii2-platron)[ RSS](/packages/matperez-yii2-platron/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (7)Used By (0)

yii2-platron
============

[](#yii2-platron)

Platron.ru payment system merchant API

Installation
------------

[](#installation)

The preferred way to install this extension is through composer.

Either run

```
php composer.phar require --prefer-dist matperez/yii2-platron"

```

or add

```
"matperez/yii2-platron": "~0.0.1"

```

to the require section of your composer.json file.

Usage
-----

[](#usage)

### Config

[](#config)

```
/** @var \matperez\yii2platron\Platron $platron */
$platron = Yii::createObject([
    'class' => \matperez\yii2platron\Platron::class,
    'secretKey' => 1234,
    'merchantId' => 12345,
    'successUrl' => ['platron/success'],
    'failureUrl' => ['platron/failure'],
]);

```

It is also could be done through the `components` config section.

### Init payment

[](#init-payment)

```
$response = $platron->initPayment(new \matperez\yii2platron\requests\InitPaymentRequest([
    'amount' => 1000,
    'orderId' => 1234,
    'description' => 'amazing goods',
    'params' => [
        'custom_param' => 5
    ],
]));
$paymentIsInitiated = $response->isSuccess();
$redirectUrl = $response->getRedirectUrl();

```

### Revoke payment

[](#revoke-payment)

```
$response = $platron->revoke(new \matperez\yii2platron\requests\RevokeRequest([
    'refundAmount' => 1000,
    'paymentId' => 1234,
]));
$transactionIsRevoked = $response->isSuccess();

```

### Check payment status

[](#check-payment-status)

```
$response = $platron->getStatus(new \matperez\yii2platron\requests\StatusRequest([
    'payment_id' => 1234,
]));
$responseIsSuccess = $response->isSuccess();
$transactionIsComplete = $response->hasStatus(\matperez\yii2platron\Api::TRANSACTION_STATUS_OK);

```

### Processing the gateway callbacks

[](#processing-the-gateway-callbacks)

Gateway callback processing action might look like this:

```
    /**
     * @return array
     * @throws BadRequestHttpException
     * @throws ServerErrorHttpException
     */
    public function actionResult()
    {
        $request = new ResultRequest(\Yii::$app->request->post());
        if (!$request->validate()) {
            throw new BadRequestHttpException('Invalid result request: '.var_export($request->errors, true));
        }
        $transaction = \Yii::$app->db->beginTransaction();
        $response = new ResultResponse([
            'status' => ResultResponse::STATUS_OK
        ]);
        try {
            // do something to commit or reject the payment..
            $transaction->commit();
        } catch (\Exception $e) {
            $transaction->rollBack();
            $response->status = ResultResponse::STATUS_ERROR;
            $response->errorDescription = $e->getMessage();
        }
        try {
            $data = $this->platron->prepareParams($_SERVER['REQUEST_URI'], $response->getResponseAttributes());
        } catch (\Exception $e) {
            throw new ServerErrorHttpException('Unable to prepare the response: '.$e->getMessage(), $e->getCode(), $e);
        }
        \Yii::$app->response->format = Response::FORMAT_XML;
        return $data;
    }

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Every ~4 days

Total

6

Last Release

3489d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b2fde2b42281c600f7dd9ee316a323b141294178c65ec60d949d7010ede1fe6?d=identicon)[matperez](/maintainers/matperez)

---

Tags

billingyii2paymentgateway

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/matperez-yii2-platron/health.svg)

```
[![Health](https://phpackages.com/badges/matperez-yii2-platron/health.svg)](https://phpackages.com/packages/matperez-yii2-platron)
```

###  Alternatives

[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

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

PHPackages © 2026

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