PHPackages                             sirumobile/siru-php-sdk - 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. sirumobile/siru-php-sdk

ActiveLibrary[Payment Processing](/categories/payments)

sirumobile/siru-php-sdk
=======================

PHP Software Development Kit for Siru Payment Gateway.

1.0.6(4y ago)04.9k1MITPHPPHP &gt;=7.1CI failing

Since Apr 11Pushed 4y ago3 watchersCompare

[ Source](https://github.com/Sirumachinery/siru-php-sdk)[ Packagist](https://packagist.org/packages/sirumobile/siru-php-sdk)[ Docs](https://github.com/Sirumachinery/siru-php-sdk)[ RSS](/packages/sirumobile-siru-php-sdk/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (1)

Siru Payment Gateway PHP SDK
============================

[](#siru-payment-gateway-php-sdk)

Siru Payment Gateway Software development kit for PHP 7.1+.

[![Tests](https://github.com/Sirumachinery/siru-php-sdk/workflows/Tests/badge.svg)](https://github.com/Sirumachinery/siru-php-sdk/workflows/Tests/badge.svg)

Requirements
------------

[](#requirements)

- PHP 7.1+
- HTTP client supported by one of the transports or your own transport. Built-in transports support Guzzle, Symfony HTTP client and Wordpress HTTP API.

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

[](#installation)

Easiest way to include the SDK is to use [composer](http://getcomposer.org). Open a command console, enter your project directory and execute:

```
$ composer require sirumobile/siru-php-sdk:^1.0
```

or by adding the following lines to your composer.json file:

```
{
    "require": {
        "sirumobile/siru-php-sdk": "^1.0"
    }
}
```

Usage
-----

[](#usage)

To get started, you need your merchantId and merchant secret. If you don't have your credentials, contact [Siru Mobile](https://sirumobile.com) to discuss which payment methods are available to you and we will send you your sandbox credentials.

Then go through our [API documentation](https://sirumobile.com/developers) to learn more about each API and message payloads.

Example
-------

[](#example)

Here is a simple example on how to create new transaction and redirect user to Siru payment flow:

```
# web/checkout.php

require_once('../vendor/autoload.php');

/**
 * Siru\Signature is used to sign outgoing messages and verify
 * responses from API. Replace $merchantId and $secret with your own credentials.
 */
$signature = new \Siru\Signature($merchantId, $secret);

/**
 * Siru\API is used to retrieve API specific classes and setting default values
 * for outgoing requests. It requires instance of Siru\Signature as parameter.
 */
$api = new \Siru\API($signature);

// Select sandbox environment (default)
$api->useStagingEndpoint();

// You can set default values for all payment requests (not required)
$api->setDefaults([
  'variant' => 'variant4',
  'purchaseCountry' => 'GB'
]);

// Create payment
try {

  $transaction = $api->getPaymentApi()
    ->set('basePrice', '5.00')
    ->set('redirectAfterSuccess', 'https://my-shop.com/checkout/success')
    ->set('redirectAfterFailure', 'https://my-shop.com/checkout/failure')
    ->set('redirectAfterCancel', 'https://my-shop.com/checkout/cancel')
    ->set('customerNumber', '0401234567')
    ->set('title', 'Concert ticket')
    ->set('description', 'Concert ticket to see an awesome band live')
    ->createPayment();

  header('location: ' . $transaction['redirect']);
  exit();

} catch(\Siru\Exception\TransportException $e) {
  echo "Unable to contact Payment API. Error was: " . $e->getMessage();

} catch(\Siru\Exception\ApiException $e) {
  echo "API request failed with error code " . $e->getCode() . ": " . $e->getMessage();
  foreach($e->getErrorStack() as $error) {
    echo $error . "";
  }
}
```

On your redirectAfter\* URLs you will need to verify that user has actually arrived from Siru Mobile payment flow and all parameters are authentic:

```
# /web/checkout/success.php, failure.php or cancel.php
$signature = new \Siru\Signature($merchantId, $secret);

if(isset($_GET['siru_event']) == true) {
  if($signature->isNotificationAuthentic($_GET)) {
    // User was redirected from Siru payment page and query parameters are authentic
  }
}
```

It is recommended that you also setup a callback URL using notifyAfterSuccess, notifyAfterFailure and notifyAfterCancel fields where Siru will automatically send notification when payment status changes. This allows you to complete the transaction even if user fails to return to your checkout page for example due to a network failure.

```
// /web/checkout/callback.php
$signature = new \Siru\Signature($merchantId, $secret);

$entityBody = file_get_contents('php://input');
$entityBodyAsJson = json_decode($entityBody, true);

if($signature->isNotificationAuthentic($entityBodyAsJson)) {
  // Notification was sent by Siru Mobile and is authentic
}
```

You can also use `\Siru\Signature` as standalone to create signature for your own code.

```
/**
 * Imaginary example on calculating Signature without using \Siru\API.
 */
$paymentRequestFields = [
  // ... required fields as described in API documentation.
];

$hash = $signature->createMessageSignature($paymentRequestFields, [], Signature::FILTER_EMPTY | Signature::SORT_FIELDS);
$paymentRequestFields['signature'] = $hash;
$paymentRequestJson = json_encode($paymentRequestFields);

// Send request using what ever HTTP
$response = $myHttpClient->send('https://staging.sirumobile.com', 'POST', $paymentRequestJson);

// Then you would check API response status, parse the JSON string in response body
// and redirect user to the payment page.
```

API documentation
-----------------

[](#api-documentation)

API documentation is available [here](https://sirumobile.com/developers).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

Every ~171 days

Recently: every ~140 days

Total

11

Last Release

1652d ago

Major Versions

v0.1.3 → 1.0.02020-03-26

PHP version history (2 changes)v0.1PHP &gt;=5.6

1.0.0PHP &gt;=7.1

### Community

Maintainers

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

---

Top Contributors

[![Jontsa](https://avatars.githubusercontent.com/u/17642317?v=4)](https://github.com/Jontsa "Jontsa (37 commits)")

---

Tags

librarypayment-gatewayphpsdksdkmobile paymentsiru

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sirumobile-siru-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/sirumobile-siru-php-sdk/health.svg)](https://phpackages.com/packages/sirumobile-siru-php-sdk)
```

###  Alternatives

[yandex-money/yandex-money-sdk-php

Yandex.Money API SDK for PHP

105168.6k2](/packages/yandex-money-yandex-money-sdk-php)[cryptonator/merchant-php-sdk

Cryptonator.com Merchant API SDK for PHP

2714.4k](/packages/cryptonator-merchant-php-sdk)[tatter/stripe

Stripe SDK integration for CodeIgniter 4

115.3k](/packages/tatter-stripe)

PHPackages © 2026

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