PHPackages                             getloy/getloy-php - 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. [API Development](/categories/api)
4. /
5. getloy/getloy-php

ActiveLibrary[API Development](/categories/api)

getloy/getloy-php
=================

PHP library for the GetLoy Payment Integration API.

1.0.3(6y ago)36741GPL-3.0-onlyPHP

Since Aug 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/getloy/getloy-php)[ Packagist](https://packagist.org/packages/getloy/getloy-php)[ Docs](https://getloy.com/)[ RSS](/packages/getloy-getloy-php/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (4)Versions (6)Used By (1)

GetLoy Integration Library for PHP
==================================

[](#getloy-integration-library-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/b6d6614b7c782f0818304acbbee75d86144b18956feba73431c2e6d3307c81be/68747470733a2f2f706f7365722e707567782e6f72672f6765746c6f792f6765746c6f792d7068702f762f737461626c65)](https://packagist.org/packages/getloy/getloy-php) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/a4c7b15222bdedd00ed7222ae1108394f36526f0ed00d045c3c0f026f2d59d1c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6765746c6f792f6765746c6f792d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/getloy/getloy-php/?branch=master) [![Total Downloads](https://camo.githubusercontent.com/ecf7a1173adf67bf372bfd76479cd024214a702be822b21324b741ec222b9852/68747470733a2f2f706f7365722e707567782e6f72672f6765746c6f792f6765746c6f792d7068702f646f776e6c6f616473)](https://packagist.org/packages/getloy/getloy-php) [![License](https://camo.githubusercontent.com/b89e9da309c7bad5429e024cff42c1a7470e884016ba2d46cb2432b091226fcc/68747470733a2f2f706f7365722e707567782e6f72672f6765746c6f792f6765746c6f792d7068702f6c6963656e7365)](https://packagist.org/packages/getloy/getloy-php)

The GetLoy Integration Library provides an easy way to access the GetLoy API from applications written in PHP.

The library currently supports the following payment methods:

- iPay88 Cambodia (all supported payment methods)
- Pi Pay
- PayWay by ABA Bank (debit/credit card only, ABA Pay only, debit/credit card only, or both)

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

[](#requirements)

PHP 5.6.0 or later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require getloy/getloy-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

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

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/getloy/getloy-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once('/path/to/getloy-php/init.php');
```

Getting Started
---------------

[](#getting-started)

A simple usage example:

```
$gateway = new \Getloy\Gateway('YOUR GETLOY TOKEN');
$gateway->registerPaymentProvider(
    \Getloy\PaymentProviders::PIPAY_KH,
    [
        'testMode' => true,
        'merchantId' => 'YOUR PIPAY MERCHANT ID',
        'storeId' => 'YOUR PIPAY STORE ID',
        'deviceId' => 'YOUR PIPAY DEVICE ID',
    ]
);

$order = new \Getloy\TransactionDetails\OrderDetails(99.99, 'USD');
$payee = new \Getloy\TransactionDetails\PayeeDetails('John', 'Doe', 'j.doe@test.com', '012345678');

echo $gateway->widgetHtml(
    'ORDER-123',
    \Getloy\PaymentProviders::PIPAY_KH,
    $order,
    $payee,
    'https://mysite.com/payment-callback.php',
    'https://mysite.com/pages/payment-complete/'
    'https://mysite.com/pages/payment-failed/'
);
```

Passing additional order details
--------------------------------

[](#passing-additional-order-details)

Most payment systems will display additional order details such as the order line items in the payment interface. This information can be provided in the `widgetHtml()` call.

```
$orderItems = new \Getloy\TransactionDetails\OrderItems();

$orderItems->add(
    new \Getloy\TransactionDetails\OrderItem('Item 1', 2, 19.98, 9.99)
);
$orderItems->add(
    new \Getloy\TransactionDetails\OrderItem('Item 2', 1, 12.50, 12.50)
);

$order = new \Getloy\TransactionDetails\OrderDetails(32.48, 'USD', null, $orderItems);
```

Callback validation
-------------------

[](#callback-validation)

Getloy will make a POST request to the callback URL provided in the `widgetHtml()` call once the payment was confirmed, but before the user is redirected to the success URL.

The callback content is validated against a hash value that includes the (secret) GetLoy Token.

The following example, `$order` and `lookupOrder()` are placeholders for objects/methods provided by your application.

```
$gateway = new \Getloy\Gateway('YOUR GETLOY TOKEN');

if ('POST' !== $_SERVER['REQUEST_METHOD']) {
    // unsupported request type
    return;
}

try {
    $callbackDetails = $gateway->readCallbackBodyAndParse();
} catch (Exception $exception) {
    // log invalid callback
    return;
}

if (Getloy\CallbackDetails::STATUS_SUCCESS !== $callbackDetails->status()) {
    // log invalid transaction status
    return;
}

// look up the order details using the transaction ID
$order = lookupOrder($callbackDetails->transactionId());

if (
    abs($order->amountPaid - $callbackDetails->amountPaid()) > 0.01
    || $order->currency !== $callbackDetails->currency()
) {
    // log transaction amount/currency mismatch
    return;
}

// update the order status to paid
$order->updateStatus('paid');
```

If you are developing your application locally, you can use a service like [ngrok](https://ngrok.com/) to redirect callbacks from GetLoy to your local webserver.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

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 ~78 days

Total

4

Last Release

2210d ago

### Community

Maintainers

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

---

Top Contributors

[![jan-san](https://avatars.githubusercontent.com/u/7543325?v=4)](https://github.com/jan-san "jan-san (9 commits)")

---

Tags

api-clientcambodiacomposercredit-cardonline-paymentspaymentpayment-integrationpayment-methodsphpwalletapipayment processinggetloy

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/getloy-getloy-php/health.svg)

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

###  Alternatives

[ebanx/ebanx

EBANX PHP library

24648.5k](/packages/ebanx-ebanx)[pay-now/paynow-php-sdk

PHP client library for accessing Paynow API

18193.9k2](/packages/pay-now-paynow-php-sdk)[everypay/everypay-php

1742.0k](/packages/everypay-everypay-php)

PHPackages © 2026

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