PHPackages                             bitrix24/b24phpsdk - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. bitrix24/b24phpsdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

bitrix24/b24phpsdk
==================

An official PHP library for the Bitrix24 REST API

3.3.0(4d ago)10244.2k↑73.4%57[88 issues](https://github.com/bitrix24/b24phpsdk/issues)[9 PRs](https://github.com/bitrix24/b24phpsdk/pulls)3MITPHPPHP 8.4.\* || 8.5.\*CI failing

Since Sep 4Pushed 3d ago8 watchersCompare

[ Source](https://github.com/bitrix24/b24phpsdk)[ Packagist](https://packagist.org/packages/bitrix24/b24phpsdk)[ Docs](https://github.com/bitrix24/b24phpsdk)[ RSS](/packages/bitrix24-b24phpsdk/feed)WikiDiscussions v3 Synced yesterday

READMEChangelog (10)Dependencies (175)Versions (55)Used By (3)

Bitrix24 REST API PHP SDK
=========================

[](#bitrix24-rest-api-php-sdk)

[![Total Downloads](https://camo.githubusercontent.com/01436fe3dac6b25269ec400dca6dbcd97118131757941b0a661d8fc97d71a1e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62697472697832342f62323470687073646b2e737667)](https://packagist.org/packages/bitrix24/b24phpsdk)[![Latest Stable Version](https://camo.githubusercontent.com/afc5956c8c307bfa56ec42be3033a7a5fed0a78f70cb55cd96cec0f26a9ec255/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62697472697832342f62323470687073646b2e737667)](https://packagist.org/packages/bitrix24/b24phpsdk)

An official PHP library for the Bitrix24 REST API

SDK Versions
------------

[](#sdk-versions)

This library ships two major versions that coexist on separate branches:

v1 (`main` branch)v3 (`v3` branch)**PHP**8.2, 8.3, 8.48.4, 8.5**API endpoints**`{portal}/rest/{user_id}/{token}/{method}``{portal}/rest/api/{user_id}/{token}/{method}`**New REST methods**—✅**Breaking changes**No✅**Semver**`1.*``3.*`**Status**Stable / production-readyActive development**Which version should I use?**

- **v1** — choose this for PHP 8.2–8.4 projects, production deployments, or when you don't need the newest Bitrix24 API methods.
- **v3** — choose this for PHP 8.4+ projects that need access to new REST API methods and are comfortable adopting breaking changes.

Build status
------------

[](#build-status)

CI\\CD check[`main`](https://github.com/bitrix24/b24phpsdk/actions?query=branch%3Amain)[`v3`](https://github.com/bitrix24/b24phpsdk/actions?query=branch%3Av3)allowed licenses[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/license-check.yml/badge.svg?branch=main)](https://github.com/bitrix24/b24phpsdk/actions/workflows/license-check.yml)[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/license-check.yml/badge.svg?branch=v3)](https://github.com/bitrix24/b24phpsdk/actions/workflows/license-check.yml)php-cs-fixer[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/php-cs-fixer.yml/badge.svg?branch=main)](https://github.com/bitrix24/b24phpsdk/actions/workflows/php-cs-fixer.yml)[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/php-cs-fixer.yml/badge.svg?branch=v3)](https://github.com/bitrix24/b24phpsdk/actions/workflows/php-cs-fixer.yml)phpstan[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpstan.yml/badge.svg?branch=main)](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpstan.yml)[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpstan.yml/badge.svg?branch=v3)](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpstan.yml)rector[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/rector.yml/badge.svg?branch=main)](https://github.com/bitrix24/b24phpsdk/actions/workflows/rector.yml)[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/rector.yml/badge.svg?branch=v3)](https://github.com/bitrix24/b24phpsdk/actions/workflows/rector.yml)deptrac—[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/deptrac.yml/badge.svg?branch=v3)](https://github.com/bitrix24/b24phpsdk/actions/workflows/deptrac.yml)unit tests[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpunit.yml/badge.svg?branch=main)](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpunit.yml)[![](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpunit.yml/badge.svg?branch=v3)](https://github.com/bitrix24/b24phpsdk/actions/workflows/phpunit.yml)Integration tests run in GitHub actions with real Bitrix24 portal

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

[](#installation)

Install the stable v1 version (PHP 8.2+):

```
composer require bitrix24/b24phpsdk:"^1.0"
```

Install the new v3 version (PHP 8.4+, breaking changes):

```
composer require bitrix24/b24phpsdk:"^3.3"
```

If you work on Windows:

- please use [WSL - Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/)
- if your filesystem is NTFS, you can disable the flag `git config --global core.protectNTFS false` for checkout folders starting with a dot.

Branch status
-------------

[](#branch-status)

BranchPurpose`main`Stable v1.x production releases`dev`v1.x integration and pre-release testing`v3`Stable v3.x production releases`v3-dev`Active v3 development with breaking changesEach major version has its own `dev` branch. Cross-version changes are applied via cherry-pick — branches are never merged across major versions.

B24PhpSdk ✨FEATURES✨
--------------------

[](#b24phpsdk-features)

Support both auth modes:

- work with auth tokens for mass-market Bitrix24 applications
- work with incoming webhooks for simple integration projects for a single Bitrix24 account

Domain core events:

- Access Token expired
- Url of a Bitrix24 account domain changed

API - level features

- Auto renew access tokens
- List queries with «start=-1» support
- offline queues

Performance improvements 🚀

- Batch queries implemented with [PHP Generators](https://www.php.net/manual/en/language.generators.overview.php) – constant low memory and low CPI usage:
- batch read data from bitrix24
- batch write data to bitrix24
- read without count flag

Development principles
----------------------

[](#development-principles)

- Good developer experience
    - auto-completion of methods at the IDE
    - typed method call signatures
    - typed results of method calls
    - helpers for typical operations
- Good documentation
    - documentation on the operation of a specific method containing a link to the official documentation
    - documentation for working with the SDK
- Performance first:
    - minimal impact on client code
    - ability to work with large amounts of data with constant memory consumption
    - efficient operation of the API using batch requests
- Modern technology stack
    - based on [Symfony HttpClient](https://symfony.com/doc/current/http_client.html)
    - actual PHP versions language features
- Reliable:
    - test coverage: unit, integration, contract
    - typical examples typical for different modes of operation and they are optimized for memory \\ performance

Architecture
------------

[](#architecture)

### Abstraction layers

[](#abstraction-layers)

```
- http2 protocol via json data structures
- symfony http client
- \Bitrix24\SDK\Core\ApiClient - work with b24 rest-api endpoints
    input: arrays \ strings
    output: Symfony\Contracts\HttpClient\ResponseInterface, operate with strings
    process: network operations
- \Bitrix24\SDK\Services\* - work with b24 rest-api entities
    input: arrays \ strings
    output: b24 response dto
    process: b24 entities, operate with immutable objects

```

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

[](#documentation)

- [Bitrix24 API documentation - English](https://apidocs.bitrix24.com/)

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

[](#requirements)

- php: &gt;=8.2
- ext-json: \*
- ext-curl: \*

Examples
--------

[](#examples)

### Work with webhook

[](#work-with-webhook)

1. Install the SDK into your project:

```
composer require bitrix24/b24phpsdk
```

2. Open Bitrix24 account: Developer resources → Other → Inbound webhook
3. Create a PHP file (for example `webhook-example.php`) and insert your webhook url into `$webhookUrl`:

```
