PHPackages                             rodrigofr/bitrix24-laravel-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. rodrigofr/bitrix24-laravel-sdk

ActiveLaravel-package[API Development](/categories/api)

rodrigofr/bitrix24-laravel-sdk
==============================

A Laravel wrapper for the Bitrix24 PHP SDK, providing seamless integration for Bitrix24 applications.

20PHP

Since Jun 4Pushed 1y agoCompare

[ Source](https://github.com/rodri-go-fr/bitrix24-laravel-sdk)[ Packagist](https://packagist.org/packages/rodrigofr/bitrix24-laravel-sdk)[ RSS](/packages/rodrigofr-bitrix24-laravel-sdk/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

rodrigofr/bitrix24-laravel-sdk
==============================

[](#rodrigofrbitrix24-laravel-sdk)

[![Laravel Version](https://camo.githubusercontent.com/4c599863b41d6f5f1bb8b443193a3a8681049074cec9e82f8386e2671246b14f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825323025374325323031312e7825323025374325323031322e782d6f72616e67652e737667)](https://camo.githubusercontent.com/4c599863b41d6f5f1bb8b443193a3a8681049074cec9e82f8386e2671246b14f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825323025374325323031312e7825323025374325323031322e782d6f72616e67652e737667)[![PHP Version](https://camo.githubusercontent.com/12ba79b4c8771d8067d75af9042c66480c860df180785c6462538e847ea1a5d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d626c75652e737667)](https://camo.githubusercontent.com/12ba79b4c8771d8067d75af9042c66480c860df180785c6462538e847ea1a5d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d626c75652e737667)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)[![Packagist Downloads](https://camo.githubusercontent.com/66ee72446bfd5ad3948249a7a50c9443d40b20eea7e61837dee33358e4b41bd5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f647269676f66722f62697472697832342d6c61726176656c2d73646b)](https://packagist.org/packages/rodrigofr/bitrix24-laravel-sdk)

A robust and easy-to-use wrapper to integrate the [Bitrix24 PHP SDK](https://github.com/bitrix24/b24phpsdk) into your Laravel applications. This package handles authentication, installation callbacks, and provides convenient access to Bitrix24 API services.

---

🌟 Features
----------

[](#-features)

- **Simple Integration:** Quick setup using a Laravel Service Provider.
- **Authentication Handling:** Automatically manages OAuth 2.0 flow and token retrieval during installation and usage.
- **API Access:** Provides a pre-configured Bitrix24 ServiceBuilder to interact with all Bitrix24 API services (CRM, Users, Tasks, etc.).
- **Example Controller:** Includes a controller with routes and views to quickly get started.
- **Views and Config Management:** Easily publish and customize the package views and config.

---

🚀 Installation
--------------

[](#-installation)

1. **Add the package to your Laravel project:**

    ```
    composer require rodrigofr/bitrix24-laravel-sdk
    ```
2. **Publish the package configuration file:**

    ```
    php artisan vendor:publish --provider="Rodrigofr\\Bitrix24LaravelSdk\\Bitrix24ServiceProvider" --tag="bitrix24-laravel-sdk-config"
    ```

    This will create the file `config/bitrix24.php`.
3. **Configure your Bitrix24 credentials in your `.env` file:**

    ```
    BITRIX24_CLIENT_ID="YOUR_BITRIX24_CLIENT_ID"
    BITRIX24_CLIENT_SECRET="YOUR_BITRIX24_CLIENT_SECRET"
    BITRIX24_SCOPE="user,crm,telephony,disk,bizproc"
    ```
4. **Configure your Bitrix24 application:**

    In the Bitrix24 Developer Portal, set the following URLs:

    - **Install URL:** `https://your-app-domain.com/bitrix24/install`
    - **Redirect URL / Application URL:** `https://your-app-domain.com/bitrix24/app`
5. **Clear route cache (important):**

    ```
    php artisan optimize:clear
    ```

---

💡 Basic Usage
-------------

[](#-basic-usage)

### 1. Included Routes

[](#1-included-routes)

The package registers the following essential routes:

- `POST /bitrix24/install`: Handles installation callback from Bitrix24.
- `GET|POST /bitrix24/app`: Main entry point of your Bitrix24 app.
- `POST /bitrix24/api/create-lead`: Example route to create a CRM lead.
- `GET /bitrix24/users`: Example route to get Bitrix24 users (e.g. `/bitrix24/users?ids=1,5,10`).

If your domain is `mi-app-laravel.com`, the URLs would look like:

- `https://mi-app-laravel.com/bitrix24/install`
- `https://mi-app-laravel.com/bitrix24/app`
- `https://mi-app-laravel.com/bitrix24/users`

### 2. API Access in Controllers

[](#2-api-access-in-controllers)

Inject `Bitrix24ServiceProvider` into any controller or service class:

```
