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

ActiveLibrary[API Development](/categories/api)

gifty/gifty-php
===============

PHP library for interacting with the Gifty API.

V1.9.1(3mo ago)62.4k↓46.2%[2 PRs](https://github.com/giftyhq/gifty-php/pulls)1MITPHPPHP ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0CI passing

Since Sep 21Pushed 1w ago2 watchersCompare

[ Source](https://github.com/giftyhq/gifty-php)[ Packagist](https://packagist.org/packages/gifty/gifty-php)[ Docs](https://gifty.nl)[ RSS](/packages/gifty-gifty-php/feed)WikiDiscussions main Synced yesterday

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

Gifty PHP SDK
=============

[](#gifty-php-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/5a7055d188afe8b89a2384d34c06adb5eb19812f2174055a7b656ddd1bca0ec7/68747470733a2f2f706f7365722e707567782e6f72672f67696674792f67696674792d7068702f76)](//packagist.org/packages/gifty/gifty-php)[![CI](https://github.com/giftyhq/gifty-php/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/giftyhq/gifty-php/actions/workflows/ci.yml/badge.svg?branch=main)[![License](https://camo.githubusercontent.com/99e7aad850c5824aafdbca5176742ac9089e00e2718f012cb03e6dedc69b3f36/68747470733a2f2f706f7365722e707567782e6f72672f67696674792f67696674792d7068702f6c6963656e7365)](//packagist.org/packages/gifty/gifty-php)

PHP library for interacting with the Gifty API. This SDK is using the public [Gifty API](https://docs.gifty.nl/api) and enables you to:

- Accept gift cards in your webshop
- Redeem and issue gift cards in your POS-system
- Retrieve gift card packages
- Retrieve store locations

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

[](#requirements)

- PHP 8.1 and later
- A valid API Key, that can be [generated](https://dashboard.gifty.nl/settings/company/developers) in your Gifty dashboard

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

[](#installation)

The SDK is published on Packagist and can be installed using Composer.

`composer require gifty/gifty-php`

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

[](#getting-started)

Before starting, it is recommended to read the documentation of the underlying [Gifty API](https://docs.gifty.nl/api) where all possible options to include are described.

Initializing the client and performing an API call is done as follows.

```
$gifty = new \Gifty\Client\GiftyClient('eyJ0eXAi....');
$giftCard = $gifty->giftCards->get('ABCDABCDABCDABCD');
```

You can also pass additional headers to the client.

```
$gifty = new \Gifty\Client\GiftyClient('eyJ0eXAi....', ['api_headers' => [
  'Accept-Language' => 'en',
  'X-Gifty-Location' => 'lc_123456789'
]]);
$giftCard = $gifty->giftCards->get('ABCDABCDABCDABCD');
```

### Retrieve Locations

[](#retrieve-locations)

```
$locations = $gifty->locations->all();
```

### Retrieve Packages

[](#retrieve-packages)

```
$packages = $gifty->packages->all();
```

### Retrieve a Package

[](#retrieve-a-package)

```
$package = $gifty->packages->get('gp_ABCDABCD');
```

### Retrieve a Gift Card

[](#retrieve-a-gift-card)

```
$giftCard = $gifty->giftCards->get('ABCDABCDABCDABCD');
```

### Issue a Gift Card

[](#issue-a-gift-card)

```
$transaction = $gifty->giftCards->issue(
  'ABCDABCDABCDABCD',
  [
    "amount" => 1250,
    "currency" => "EUR",
    "promotional" => false
  ]
);
```

### Redeem a Gift Card

[](#redeem-a-gift-card)

```
$transaction = $gifty->giftCards->redeem(
  'ABCDABCDABCDABCD',
  [
    "amount" => 1250,
    "currency" => "EUR",
    "capture" => false
  ]
);
```

### Extend a Gift Card

[](#extend-a-gift-card)

```
$transaction = $gifty->giftCards->extend(
  'ABCDABCDABCDABCD',
  [
    "expires_at" => "2027-09-15T12:42:42+00:00"
  ]
);
```

### Retrieve all Transactions

[](#retrieve-all-transactions)

```
$transactions = $gifty->transactions->all(['limit' => 5]);
```

### Retrieve all Transactions filtered by gift card ID

[](#retrieve-all-transactions-filtered-by-gift-card-id)

```
$transactions = $gifty->transactions->all(['giftcard' => 'gc_123456789']);
```

### Retrieve a Transaction

[](#retrieve-a-transaction)

```
$transaction = $gifty->transactions->get('tr_BV94pGgqRvgobxvrLX28jEl0');
```

### Capture a Transaction

[](#capture-a-transaction)

```
$transaction = $gifty->transactions->capture('tr_BV94pGgqRvgobxvrLX28jEl0');
```

### Release a Transaction

[](#release-a-transaction)

```
$transaction = $gifty->transactions->release('tr_BV94pGgqRvgobxvrLX28jEl0');
```

### Refund a Transaction

[](#refund-a-transaction)

```
$transaction = $gifty->transactions->refund(
  'tr_BV94pGgqRvgobxvrLX28jEl0',
  [
    "amount" => 1250,
    "currency" => "EUR",
    "reason" => "CUSTOMER_REQUEST",
    "reason_description" => "Customer returned one item from the order"
  ]
);
```

Development
-----------

[](#development)

Clone the Git repository, so you have a local working copy.

`git clone https://github.com/giftyhq/gifty-php`

Install required (developing) dependencies using Composer.

`composer install`

Run and create PHPUnit tests for your modifications.

`composer test`

Make sure you follow the PSR12 coding standards.

`composer phpstan` &amp; `composer phpcs`

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance90

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 81.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 ~105 days

Recently: every ~173 days

Total

20

Last Release

101d ago

Major Versions

v0.0.1 → v1.0.02020-09-22

PHP version history (8 changes)v0.0.1PHP &gt;=7.2.0

V1.1.0PHP ~7.3.0||~7.4.0||~8.0.0

V1.1.1PHP ~7.3.0||~7.4.0||~8.0.0||~8.1.0

V1.3.0PHP ~7.4.0||~8.0.0||~8.1.0

V1.5.0PHP ~7.4.0||~8.0.0||~8.1.0||~8.2.0

V1.7.0PHP ~8.0.0||~8.1.0||~8.2.0||~8.3.0

V1.8.1PHP ~8.0.0||~8.1.0||~8.2.0||~8.3.0||~8.4.0

V1.8.2PHP ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/18f4ae7479cd095abb01b338c16c4ef537304283ea89ce4bdd8584d9bc6084f6?d=identicon)[sidvanvliet](/maintainers/sidvanvliet)

![](https://www.gravatar.com/avatar/903d5a6280175efedd95c7be0fc917b358d839c885f47e29fcbbdb0db7acb46a?d=identicon)[jeroen@gifty.nl](/maintainers/jeroen@gifty.nl)

---

Top Contributors

[![Jeroenwv](https://avatars.githubusercontent.com/u/4358062?v=4)](https://github.com/Jeroenwv "Jeroenwv (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![sidvanvliet](https://avatars.githubusercontent.com/u/40121703?v=4)](https://github.com/sidvanvliet "sidvanvliet (4 commits)")

---

Tags

phpsdkapigifty

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M318](/packages/openai-php-client)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k409.0k6](/packages/theodo-group-llphant)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)

PHPackages © 2026

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