Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

B24Phpsdk Laravel Package

bitrix24/b24phpsdk

Bitrix24 PHP SDK for working with the Bitrix24 REST API from Laravel or plain PHP. Provides typed clients, authentication helpers, API method wrappers, pagination, and webhook/OAuth support to simplify integrating CRM, tasks, chats, and other Bitrix24 modules.

Deep Wiki
Context7

bitrix24/b24phpsdk is a PHP SDK for integrating with the Bitrix24 REST API, designed to simplify building Laravel/PHP apps that interact with Bitrix24 CRM and collaboration tools. It provides a clean, developer-friendly interface for calling endpoints, handling authorization, and organizing API workflows.

Use it to reduce boilerplate around HTTP requests and focus on your domain logic while staying close to Bitrix24’s capabilities.

  • REST API client abstractions for common Bitrix24 operations
  • Support for OAuth/authorization flows and token handling
  • Convenient methods for CRM entities (leads, deals, contacts, etc.)
  • Built-in helpers for requests, responses, and error handling
  • Extensible structure to add/customize endpoints as needed
Frequently asked questions about B24Phpsdk
How do I install and set up **bitrix24/b24phpsdk** in a Laravel project?
Install via Composer with `composer require bitrix24/b24phpsdk`, then register the service provider in `config/app.php`. Use the `B24` facade or dependency injection to access clients like `B24::leads()` or `B24::contacts()`. The SDK auto-configures Guzzle under the hood for HTTP requests.
Does this SDK support Laravel’s service container and facades?
Yes, the SDK is designed for Laravel’s ecosystem. Bind it as a singleton in `AppServiceProvider` (e.g., `B24Client`) and use facades like `B24::deals()->create()` for fluent syntax. Alternatively, inject `B24ClientInterface` directly into controllers or services.
What Laravel versions does **bitrix24/b24phpsdk** support?
The SDK targets Laravel 8.x and 9.x, leveraging features like dependency injection and facades. For Laravel 7.x, check the package’s `composer.json` for compatibility notes or fork the project to adapt to older DI containers.
How does OAuth authentication work with Laravel’s caching?
Store OAuth tokens in Laravel’s cache (e.g., `cache()->remember()`) or database for persistence. The SDK handles token refreshes, but you can extend it to dispatch Laravel events (e.g., `B24TokenRefreshed`) or use queue jobs for async refreshes to avoid race conditions.
Can I map Bitrix24 CRM entities (e.g., Deals) to Laravel Eloquent models?
Yes, the SDK returns raw API responses, but you can hydrate them into custom DTOs or Eloquent models. Use Laravel’s `fillable` properties or accessors to map fields like `deal_stage` or `contact_id` to your database schema.
How do I handle Bitrix24 API rate limits in Laravel?
Leverage Laravel middleware to enforce rate limits. For example, create a middleware that checks `X-RateLimit-Remaining` headers and throttles requests using `throttle()` or `rateLimit()` helpers. The SDK’s Guzzle client supports middleware integration.
What’s the best way to test this SDK without hitting the Bitrix24 API?
Use the `B24ClientInterface` to mock dependencies in PHPUnit. Replace the real client with a test double that returns predefined responses. For example, bind a mock in `AppServiceProvider` during testing: `$app->bind(B24ClientInterface::class, fn() => new MockB24Client())...`
How do I extend the SDK for custom Bitrix24 endpoints not covered by the package?
Extend the SDK via service providers or traits. Add custom methods to the `B24Client` class or create a new client (e.g., `B24CustomClient`) that extends the base client. Register it in `AppServiceProvider` and use it alongside the default clients.
What happens if the Bitrix24 API is unavailable? How can I implement retries or fallbacks?
Use Laravel’s queue system to retry failed API calls. Wrap SDK operations in a `try-catch` block and dispatch a job (e.g., `RetryB24ApiCall`) with exponential backoff. For critical failures, implement a fallback (e.g., cache stale data or notify admins via Laravel Notifications).
Are there alternatives to this SDK for Bitrix24 integrations in Laravel?
For lightweight needs, use Guzzle directly with Bitrix24’s API docs. For more structure, consider forking this SDK or using a generic HTTP client like `spatie/laravel-query-builder` with custom Bitrix24 logic. However, this SDK offers Laravel-native abstractions (e.g., facades, events) that alternatives lack.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware