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

ActiveLibrary[Payment Processing](/categories/payments)

craftgate/craftgate
===================

craftgate php client

1.0.52(2mo ago)2889.9k↓26.5%7[1 PRs](https://github.com/craftgate/craftgate-php-client/pulls)MITPHPPHP &gt;=5.3.0CI passing

Since Jan 20Pushed 1mo ago12 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (64)Used By (0)

Craftgate PHP Client
====================

[](#craftgate-php-client)

[![Build Status](https://github.com/craftgate/craftgate-php-client/actions/workflows/craftgate-build.yml/badge.svg?branch=master)](https://github.com/craftgate/craftgate-php-client/actions?query=branch%3Amaster)[![Latest Stable Version](https://camo.githubusercontent.com/ba8ccc10cd90f13b89ff8cac64c1e4c42fc6ce54faa2cd328d7007a29bda693c/68747470733a2f2f706f7365722e707567782e6f72672f6372616674676174652f6372616674676174652f762f737461626c652e737667)](https://packagist.org/packages/craftgate/craftgate)[![Total Downloads](https://camo.githubusercontent.com/90920b209b8f51777ca86e436e03b4127a3dbcc0f47b2559761b6082e600a088/68747470733a2f2f706f7365722e707567782e6f72672f6372616674676174652f6372616674676174652f646f776e6c6f6164732e737667)](https://packagist.org/packages/craftgate/craftgate)[![License](https://camo.githubusercontent.com/87f9636a3f206f104f809a099b4d2a98040d3b7982af603b2082d11922a76d25/68747470733a2f2f706f7365722e707567782e6f72672f6372616674676174652f6372616674676174652f6c6963656e73652e737667)](https://packagist.org/packages/craftgate/craftgate)[![Gitpod ready-to-code](https://camo.githubusercontent.com/c01324668ea00cd2b02dc9fbf541676fb30543b69ef99a070d62a110917126d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f476974706f642d72656164792d2d746f2d2d636f64652d626c75653f6c6f676f3d676974706f64)](https://gitpod.io/#https://github.com/craftgate/craftgate-php-client)

This repo contains the PHP client for Craftgate API.

[![Open in Gitpod](https://camo.githubusercontent.com/6a4edb76a7e92e0faad09a11e42cba7c39803ee6723f8cb1b801f91113d59695/68747470733a2f2f676974706f642e696f2f627574746f6e2f6f70656e2d696e2d676974706f642e737667)](https://gitpod.io/#https://github.com/craftgate/craftgate-php-client)

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

[](#requirements)

- PHP 5.3 and later.

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

[](#dependencies)

The following PHP extensions are required:

- curl
- json

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

[](#installation)

### Composer

[](#composer)

Download [Composer](https://getcomposer.org/download/) and run the following command under your project.

```
composer require craftgate/craftgate
```

### Manual Installation

[](#manual-installation)

You need to download the latest [release](https://github.com/craftgate/craftgate-php-client/releases) and copy to your project. Then, include the autoload file as shown below. This file will autoload all related classes into your project on-demand.

```
require '/path/to/craftgate-php-client/autoload.php';
```

Usage
-----

[](#usage)

To access the Craftgate API you'll first need to obtain API credentials (e.g. an API key and a secret key). If you don't already have a Craftgate account, you can signup at [https://craftgate.io/](https://craftgate.io)

Once you've obtained your API credentials, you can start using Craftgate by instantiating a `Craftgate\Craftgate` with your credentials.

```
$craftgate = new \Craftgate\Craftgate(array(
    'apiKey' => '',
    'secretKey' => '',
));
```

By default the Craftgate client connects to the production API servers at `https://api.craftgate.io`. For testing purposes, please use the sandbox URL `https://sandbox-api.craftgate.io`.

```
$craftgate = new \Craftgate\Craftgate(array(
    'apiKey' => '',
    'secretKey' => '',
    'baseUrl' => 'https://sandbox-api.craftgate.io',
));
```

Examples
--------

[](#examples)

Included in the project are a number of examples that cover almost all use-cases. Refer to [the `samples/` folder](./samples) for more info.

### Running the Examples

[](#running-the-examples)

If you've cloned this repo on your development machine and wish to run the examples you can run an example with the command `./vendor/bin/phpunit`

### Credit Card Payment Use Case

[](#credit-card-payment-use-case)

Let's quickly review an example where we implement a credit card payment scenario.

> For more examples covering almost all use-cases, check out the [examples in the `samples/` folder](./samples)

```
$craftgate = new \Craftgate\Craftgate(array(
    'apiKey' => '',
    'secretKey' => '',
    'baseUrl' => 'https://sandbox-api.craftgate.io',
));

$request = array(
    'price' => 100,
    'paidPrice' => 100,
    'walletPrice' => 0,
    'installment' => 1,
    'currency' => \Craftgate\Model\Currency::TL,
    'paymentGroup' => \Craftgate\Model\PaymentGroup::LISTING_OR_SUBSCRIPTION,
    'conversationId' => '456d1297-908e-4bd6-a13b-4be31a6e47d5',
    'card' => array(
        'cardHolderName' => 'Haluk Demir',
        'cardNumber' => '5258640000000001',
        'expireYear' => '2044',
        'expireMonth' => '07',
        'cvc' => '000'
    ),
    'items' => array(
        array(
            'externalId' => \Craftgate\Util\Guid::generate(),
            'name' => 'Item 1',
            'price' => 30
        ),
        array(
            'externalId' => \Craftgate\Util\Guid::generate(),
            'name' => 'Item 2',
            'price' => 50
        ),
        array(
            'externalId' => \Craftgate\Util\Guid::generate(),
            'name' => 'Item 3',
            'price' => 20
        )
    )
);

$response = $craftgate->payment()->createPayment($request);

var_dump($response);
```

### Contributions

[](#contributions)

For all contributions to this client please see the contribution guide [here](CONTRIBUTING.md).

License
-------

[](#license)

MIT

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor4

4 contributors hold 50%+ of commits

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

Recently: every ~50 days

Total

54

Last Release

89d ago

Major Versions

0.0.1 → 1.0.02021-01-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/21279ee80bd9ffd375ba40171565a3c8d4169559b6353a6575dd842248c9064d?d=identicon)[craftgate](/maintainers/craftgate)

---

Top Contributors

[![sotuzun](https://avatars.githubusercontent.com/u/335067?v=4)](https://github.com/sotuzun "sotuzun (56 commits)")[![AlicanAkkus](https://avatars.githubusercontent.com/u/6232654?v=4)](https://github.com/AlicanAkkus "AlicanAkkus (23 commits)")[![abalikci](https://avatars.githubusercontent.com/u/108258717?v=4)](https://github.com/abalikci "abalikci (16 commits)")[![tuncaserhat](https://avatars.githubusercontent.com/u/35580464?v=4)](https://github.com/tuncaserhat "tuncaserhat (16 commits)")[![MasterSlave](https://avatars.githubusercontent.com/u/7658348?v=4)](https://github.com/MasterSlave "MasterSlave (14 commits)")[![onurpolattimur](https://avatars.githubusercontent.com/u/23136437?v=4)](https://github.com/onurpolattimur "onurpolattimur (13 commits)")[![deryacakmak](https://avatars.githubusercontent.com/u/36774966?v=4)](https://github.com/deryacakmak "deryacakmak (12 commits)")[![beratallahverdi](https://avatars.githubusercontent.com/u/35176276?v=4)](https://github.com/beratallahverdi "beratallahverdi (10 commits)")[![semihshn](https://avatars.githubusercontent.com/u/57491762?v=4)](https://github.com/semihshn "semihshn (7 commits)")[![mozcan](https://avatars.githubusercontent.com/u/6410488?v=4)](https://github.com/mozcan "mozcan (6 commits)")[![reywyn](https://avatars.githubusercontent.com/u/9061788?v=4)](https://github.com/reywyn "reywyn (5 commits)")[![beransantur](https://avatars.githubusercontent.com/u/65870162?v=4)](https://github.com/beransantur "beransantur (5 commits)")[![byofficial](https://avatars.githubusercontent.com/u/28408826?v=4)](https://github.com/byofficial "byofficial (4 commits)")[![ygunayer](https://avatars.githubusercontent.com/u/592318?v=4)](https://github.com/ygunayer "ygunayer (2 commits)")[![krmgns](https://avatars.githubusercontent.com/u/1508306?v=4)](https://github.com/krmgns "krmgns (2 commits)")[![lemiorhan](https://avatars.githubusercontent.com/u/1199195?v=4)](https://github.com/lemiorhan "lemiorhan (2 commits)")[![omeraplak](https://avatars.githubusercontent.com/u/1110414?v=4)](https://github.com/omeraplak "omeraplak (2 commits)")[![ozmenfurkan](https://avatars.githubusercontent.com/u/235353373?v=4)](https://github.com/ozmenfurkan "ozmenfurkan (2 commits)")[![mtbrkrgn](https://avatars.githubusercontent.com/u/39336991?v=4)](https://github.com/mtbrkrgn "mtbrkrgn (1 commits)")[![ibo](https://avatars.githubusercontent.com/u/701367?v=4)](https://github.com/ibo "ibo (1 commits)")

---

Tags

client-librarycraftgatecraftgate-apipaymentpayment-gatewaypayment-orchestrationphpphp-clientphp-sdkcraftgatecraftgate.io

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)
