PHPackages                             b24io/loyalty-php-sdk - 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. b24io/loyalty-php-sdk

ActiveLibrary[API Development](/categories/api)

b24io/loyalty-php-sdk
=====================

B24io.Loyalty: PHP-SDK for bonus cards and loyalty program for Bitrix24

4.1.0(1y ago)1082[2 issues](https://github.com/b24io/loyalty-php-sdk/issues)MITPHPPHP 8.2.\* || 8.3.\*

Since Jan 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/b24io/loyalty-php-sdk)[ Packagist](https://packagist.org/packages/b24io/loyalty-php-sdk)[ Docs](https://www.bitrix24.ru/apps/?app=b24io.loyalty)[ RSS](/packages/b24io-loyalty-php-sdk/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (22)Versions (22)Used By (0)

loyalty-php-sdk
===============

[](#loyalty-php-sdk)

[![License](https://camo.githubusercontent.com/b4300b6014edf47342cf1d8cc9cbb3954a5c44923f2f0a21d5276991dfdcd2e7/68747470733a2f2f706f7365722e707567782e6f72672f623234696f2f6c6f79616c74792d7068702d73646b2f6c6963656e73652e737667)](https://packagist.org/packages/b24io/loyalty-php-sdk) [![Total Downloads](https://camo.githubusercontent.com/64c88c396a675fa9657d3360aef3a79ae4553f12c74192b6596d4328609b172d/68747470733a2f2f706f7365722e707567782e6f72672f623234696f2f6c6f79616c74792d7068702d73646b2f646f776e6c6f6164732e737667)](https://packagist.org/packages/b24io/loyalty-php-sdk)

Loyalty PHP SDK is a tool for work with REST-API Bitrix24 Application [Loyalty Program and bonus cards for Bitrix24 CRM](https://www.bitrix24.ru/apps/?app=b24io.loyalty)

- Loyalty app adds bonus card for Bitrix24 client profile in CRM
- Loyalty app support transactions for payment and accrual operations
- store percentage of discount
- operations with cards: create, read, delete, block

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

[](#documentation)

- [REST-API documentation](https://loyalty.b24.cloud/public/docs/api/v2/)

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

[](#installation)

Via Composer

```
$ composer require b24io/loyalty-php-sdk
```

### Versions

[](#versions)

loyalty-php-sdk
 versionsupport statusbuild
 statusREST-API
versionPHP
 versions**v4.x**🟩 **active**[![integration tests](https://github.com/b24io/loyalty-php-sdk/actions/workflows/integration-v4.yml/badge.svg?branch=v4)](https://github.com/b24io/loyalty-php-sdk/actions/workflows/integration-v4.yml/badge.svg?branch=v4)
 [![phpstan](https://github.com/b24io/loyalty-php-sdk/actions/workflows/phpstan.yml/badge.svg?branch=v4)](https://github.com/b24io/loyalty-php-sdk/actions/workflows/phpstan.yml/badge.svg?branch=v4)**2**`8.2`,`8.3`v3.x🟨 bugfix only[![integration tests](https://github.com/b24io/loyalty-php-sdk/actions/workflows/integration-v4.yml/badge.svg?branch=v3)](https://github.com/b24io/loyalty-php-sdk/actions/workflows/integration-v4.yml/badge.svg?branch=v3)
 [![phpstan](https://github.com/b24io/loyalty-php-sdk/actions/workflows/phpstan.yml/badge.svg?branch=v3)](https://github.com/b24io/loyalty-php-sdk/actions/workflows/phpstan.yml/badge.svg?branch=v3)2`7.4`v2🟥 end of life ☠️1`7.4`v1🟥 end of life ☠️1`7.4`### Requirements

[](#requirements)

Loyalty PHP SDK works with PHP 8.2 or above, need `ext-json` and `ext-curl` support

Authentication with admin and user roles
----------------------------------------

[](#authentication-with-admin-and-user-roles)

SDK can work with two roles:

- `admin` - can work with all cards in his account and loyalty application instance
- `user` - can work only with his own card

We work with many accounts, each account has a `CLIENT_API_KEY`If you want work in admin role you must use `ADMIN_API_KEY` to sign queries. If you want work with client role in JS you must use `CLIENT_API_KEY` and `CARD_UUID` as user API key.

Domain entities available from REST-API
---------------------------------------

[](#domain-entities-available-from-rest-api)

Legend

- ✅ — available wia rest-api and implemented in PHP-SDK
- 🛠 — available wia rest-api and **not** implemented in PHP-SDK
- ❌ — not implemented in rest-api

### Cards

[](#cards)

Work with card as an `admin` role

MethodStatusDescription`list`✅get card list with page navigation`getById`✅get card by uuid`count`✅️count cards`delete`🛠️delete card by uuid`add`✅️add new card`block`❌️block card by uuid`unblock`❌️unblock card by uuid`setLevel`❌️set card level by uuid`setPercentage`❌️set card percentage by uuidWork with card as a `user` role

MethodStatusDescription`getById`🛠get card by uuidIf you need export all cards, you can use `CardsFetcher`

### CardLevels

[](#cardlevels)

Work with card levels as an `admin` role

MethodStatusDescription`list`🛠get card level list`add`🛠add new card level`delete`🛠delete card level`update`❌️update card level### Transactions

[](#transactions)

Work with transactions as an `admin` role.

Transactions service contains methods, list method work with pagination

MethodDescription`list`get transactions list for all cards with pagination`count`count transactions`getByCardNumber`get transactions list for current card number`processAccrualTransactionByCardNumber`process accrual transaction`processPaymentTransactionByCardNumber`process payment transactionif you want read all transactions without pagination you can work with `TransactionsFetcher`All fetcher methods return generator, under the hood fetcher use pagination.

MethodDescription`list`get transactions list for all cards`listByCardNumber`list all transactions for current cardWork with transactions as an `user` role

MethodStatusDescription`getByCardId`🛠get transactions list for current card### Contacts

[](#contacts)

Work with contacts as an `admin` role

MethodStatusDescription`list`✅get contacts list`getById`✅get contact by id`add`✅add new contact`update`❌️update contact`delete`❌️delete contact`count`✅count contacts`startAuthByPhone`❌️start auth attempt by phone`finishAuth`❌️finish auth attemptWork with contacts as an `user` role

MethodStatusDescription`getById`🛠get contact by id`startAuthByPhone`🛠start auth attempt by phone`finishAuth`🛠finish auth attemptIf you need export all contacts, you can use `ContactsFetcher`

### Company

[](#company)

Work with company as an `admin` role

MethodStatusDescription`current`❌get current company`add`❌️add company`update`❌️update company`delete`❌️delete companyWork with company as an `user` role

MethodStatusDescription`current`🛠get current company### ApplicationJournal

[](#applicationjournal)

Work with application journal as an `admin` role

MethodStatusDescription`list`🛠get application journal items list with page navigation`getById`🛠get application journal item by id### TouchPoints

[](#touchpoints)

Work with touch points as an `admin` role

MethodStatusDescription`list`🛠get touch points list with page navigation`getById`🛠get touch point item by id`add`🛠add new touch point`update`❌️update touch point`delete`🛠️delete touch pointBasic Usage
-----------

[](#basic-usage)

Command line utilities
----------------------

[](#command-line-utilities)

Command line utilities for work via REST-API

```
php bin/console
```

- `cards:export` Export loyalty cards to csv file
- `transactions:bulk-transaction` Bulk transaction to all active cards: accrual or payment
- `transactions:load-from-file` Process transactions from csv file
- `transactions:export` Export transactions to csv file

Submitting bugs and feature requests
------------------------------------

[](#submitting-bugs-and-feature-requests)

Bugs and feature request are tracked on [GitHub](https://github.com/b24io/loyalty-php-sdk/issues)

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

[](#development)

### Testing

[](#testing)

Run static analysis tool

```
make phpstan
```

Support
-------

[](#support)

-

Security
--------

[](#security)

If you discover any security related issues, please contact us at

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 94.1% 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 ~122 days

Recently: every ~58 days

Total

19

Last Release

486d ago

Major Versions

0.1.3 → 1.0.02020-01-08

1.1.0 → 2.0.02020-02-02

2.1.2 → 3.02024-05-08

3.1.0 → 4.0.02024-05-12

v3.x-dev → v4.x-dev2025-01-12

PHP version history (4 changes)0.1.0PHP &gt;=7.1

2.1.1PHP 7.4.\*|8.\*

3.0PHP 8.2.\* || 8.3.\*

3.2.0PHP 7.4.\* || 8.2.\* || 8.3.\*

### Community

Maintainers

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

---

Top Contributors

[![b24io-sdk](https://avatars.githubusercontent.com/u/32178121?v=4)](https://github.com/b24io-sdk "b24io-sdk (48 commits)")[![mesilov](https://avatars.githubusercontent.com/u/1843965?v=4)](https://github.com/mesilov "mesilov (3 commits)")

---

Tags

b24iobitrix24loyaltyloyalty-cardloyalty-rewardsloyaltyprogramphp-libraryREST APIBitrix24loyalty programbonus cardsloyalty program SDK

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/b24io-loyalty-php-sdk/health.svg)

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

###  Alternatives

[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

9230.2k4](/packages/bitrix24-b24phpsdk)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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