PHPackages                             moka/moka-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. moka/moka-php

ActiveLibrary

moka/moka-php
=============

Moka United PHP Client

1.1(3y ago)6126↓100%1MITPHPPHP &gt;=5.6

Since Sep 26Pushed 1mo ago2 watchersCompare

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

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Moka United API PHP Client
==========================

[](#moka-united-api-php-client)

The Moka United API PHP Client provides convenient access to the [Moka United API](https://developer.mokaunited.com/) from applications written in the PHP language.

[![image](https://camo.githubusercontent.com/b227edfd3d87dc481683c1a400d2b9180de14654d4e7f5b98cd57ffb1b7760cb/68747470733a2f2f6f7074696d6973746875622e636f6d2f63646e2f6d6f6b612f6d6f6b612d6170692d7068702d636c69656e742e706e673f7634)](https://camo.githubusercontent.com/b227edfd3d87dc481683c1a400d2b9180de14654d4e7f5b98cd57ffb1b7760cb/68747470733a2f2f6f7074696d6973746875622e636f6d2f63646e2f6d6f6b612f6d6f6b612d6170692d7068702d636c69656e742e706e673f7634)

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

[](#requirements)

PHP 5.6.0 and later.

Composer
--------

[](#composer)

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

```
composer require moka/moka-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/optimisthub/moka-php/releases). Then, to use the bindings, include the `autoload.php` file.

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

Dependencies
------------

[](#dependencies)

The bindings require the following extensions in order to work properly:

- [`curl`](https://secure.php.net/manual/en/book.curl.php)
- [`json`](https://secure.php.net/manual/en/book.json.php)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

SSL / TLS
=========

[](#ssl--tls)

PCI-DSS rules only allow the use of TLS 1.2 and above protocols. Please ensure that your application POST to Moka URL over these protocols. Otherwise, errors such as 'Connection will be closed or Connection Closed' will be received.

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

[](#getting-started)

Simple usage looks like

```
$moka = new \Moka\MokaClient([
    'dealerCode' => 'xxx',
    'username' => 'xxx',
    'password' => 'xxx',
]);
```

By default PHP client connects to Live Environment URL:  For testing purposes please use Test Environment URL:

```
$moka = new \Moka\MokaClient([
    'dealerCode' => 'xxx',
    'username' => 'xxx',
    'password' => 'xxx',
    'baseUrl' => 'https://service.refmoka.com'
]);
```

Create Payment
--------------

[](#create-payment)

```
$moka = new \Moka\MokaClient([
    'dealerCode' => 'xxx',
    'username' => 'xxx',
    'password' => 'xxx',
]);

$request = new Moka\Model\CreatePaymentRequest();

$request->setCardHolderFullName('John Doe');
$request->setCardNumber('5555666677778888');
$request->setExpMonth('09');
$request->setExpYear('2024');
$request->setCvcNumber('123');
$request->setAmount(0.01);
$request->setCurrency('TL');
$request->setInstallmentNumber(1);
$request->setClientIp('192.168.1.116');
$request->setOtherTrxCode('3D5ABC24-456"');
$request->setIsPoolPayment(0);
$request->setIsTokenized(0);
$request->setIntegratorId(0);
$request->setSoftware('Software');
$request->setDescription('');
$request->setIsPreAuth(0);

$buyer = new Moka\Model\Buyer();
$buyer->setBuyerFullName('John Doe');
$buyer->setBuyerGsmNumber('5551110022');
$buyer->setBuyerEmail('email@email.com');
$buyer->setBuyerAddress('Levent Mah. Meltem Sok. İş Kuleleri Kule 2 No: 10 / 4 Beşiktaş / İstanbul');

$request->setBuyerInformation($buyer);

$payment = $moka->payments()->create($request);

$payment->getData();
$payment->getResultCode();
$payment->getResultMessage();
$payment->getException();
```

Documentation
-------------

[](#documentation)

See the [Moka United API docs](https://developer.mokaunited.com).

Test Cards
----------

[](#test-cards)

See the [Test Cards](https://developer.mokaunited.com/home.php?page=test-kartlari).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance59

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~121 days

Total

2

Last Release

1203d ago

### Community

Maintainers

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

---

Top Contributors

[![optimistlab](https://avatars.githubusercontent.com/u/62239469?v=4)](https://github.com/optimistlab "optimistlab (3 commits)")[![fatihtoprak](https://avatars.githubusercontent.com/u/2514952?v=4)](https://github.com/fatihtoprak "fatihtoprak (1 commits)")

---

Tags

moka-paymoka-paymentmoka-posoptimist-hubphp-api-clientphp-clientmokamoka phpmoka apimoka php client

### Embed Badge

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

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

PHPackages © 2026

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