PHPackages                             white/white - 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. white/white

ActiveLibrary[Payment Processing](/categories/payments)

white/white
===========

White makes accepting online payments in the Middle East a piece of cake

v2.0.3(11y ago)37.8k↓100%5PHP

Since Sep 10Pushed 11y ago2 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (16)Used By (0)

White PHP
=========

[](#white-php)

White makes accepting payments in the Middle East ridiculously easy. Sign up for an account at [whitepayments.com](http://whitepayments.com).

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

[](#getting-started)

Using White with your PHP project is simple.

If you're using [Composer](https://getcomposer.org/doc/00-intro.md#installation-nix) (and really, who isn't these days amirite?), you can simply run:

```
php composer.phar require white/white
```

.. or add a line to your `composer.json` file:

```
{
    "require": {
        "white/white": "*"
    }
}
```

Now, running `php composer.phar install` will pull the library directly to your local `vendor` folder.

**Note:** If you're running on a shared host, then you may need to set the `allow_url_fopen` flag for the `php` commands. For the install command, for example, this would look like `php -d allow_url_fopen=On composer.phar install`. The `-d` overrides the `php.ini` settings, where `allow_url_fopen` is usually set to `Off`.

Using White
-----------

[](#using-white)

You'll need an account with White if you don't already have one (grab one real quick at [whitepayments.com](http://whitepayments.com) and come right back .. we'll wait).

Got an account? Great .. let's do this.

### 1. Initializing White

[](#1-initializing-white)

To get started, you'll need to initialize White with your secret API key. Here's how that looks (fear not .. we're using a test key, so no real money will be exchanging hands):

```
require_once('vendor/autoload.php'); # At the top of your PHP file

# Initialize White object
White::setApiKey('test_sec_k_25dd497d7e657bb761ad6');
```

That's it! You probably want to do something with the White object though -- it gets really bored when it doesn't have anything to do.

Let's run a transaction, shall we.

### 2. Processing a transaction through White

[](#2-processing-a-transaction-through-white)

Now, for the fun part. Here's all the code you need to process a transaction with White:

```
White_Charge::create(array(
  "amount" => 10500, // AED 105.00
  "currency" => "aed",
  "card" => array(
    "number" => "4242424242424242",
    "exp_month" => 11,
    "exp_year" => 2016,
    "cvc" => "123"
  ),
  "description" => "Charge for test@example.com"
));
```

This transaction should be successful since we used the `4242 4242 4242 4242` test credit card. For a complete list of test cards, and their expected output you can check out this link [here](https://whitepayments.com/docs/testing/).

How can you tell that it was successful? Well, if no exception is raised then you're in the clear.

### 3. Handling Errors

[](#3-handling-errors)

Any errors that may occur during a transaction is raised as an Exception. Here's an example of how you can handle errors with White:

```
try {
  // Use White's bindings...
} catch(White_Error_Banking $e) {
  // Since it's a decline, White_Error_Banking will be caught
  print('Status is:' . $e->getHttpStatus() . "\n");
  print('Code is:' . $e->getErrorCode() . "\n");
  print('Message is:' . $e->getMessage() . "\n");

} catch (White_Error_Request $e) {
  // Invalid parameters were supplied to White's API

} catch (White_Error_Authentication $e) {
  // There's a problem with that API key you provided

} catch (White_Error $e) {
  // Display a very generic error to the user, and maybe send
  // yourself an email

} catch (Exception $e) {
  // Something else happened, completely unrelated to White

}
```

Testing White
-------------

[](#testing-white)

It's probably a good idea to run the unit tests to make sure that everything is fine and dandy. That's also simple.. just run this command from the root of your project folder:

```
php vendor/bin/phpunit tests --bootstrap vendor/autoload.php
```

**Note:** you'll need to pull the development dependencies as well, using `composer update --dev` in order to run the test suites.

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

[](#contributing)

Read our [Contributing Guidelines](CONTRIBUTING.md) for details

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 57.8% 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 ~13 days

Total

14

Last Release

4089d ago

Major Versions

1.4.1 → v2.0.02015-01-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a7ccea435d89670ffcc155a44b3452c4c99e69015fd58decc18171ea75006e7?d=identicon)[white](/maintainers/white)

---

Top Contributors

[![nizay](https://avatars.githubusercontent.com/u/13042226?v=4)](https://github.com/nizay "nizay (26 commits)")[![yazinsai](https://avatars.githubusercontent.com/u/1846034?v=4)](https://github.com/yazinsai "yazinsai (13 commits)")[![schoren](https://avatars.githubusercontent.com/u/314548?v=4)](https://github.com/schoren "schoren (4 commits)")[![aiouy](https://avatars.githubusercontent.com/u/5013513?v=4)](https://github.com/aiouy "aiouy (1 commits)")[![alovak](https://avatars.githubusercontent.com/u/19233?v=4)](https://github.com/alovak "alovak (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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