PHP code example of darvinstudio / darvin-bitrix24-bundle

1. Go to this page and download the library: Download darvinstudio/darvin-bitrix24-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

darvinstudio / darvin-bitrix24-bundle example snippets


use Darvin\Bitrix24Bundle\Client\ClientInterface;
use Darvin\Bitrix24Bundle\Lead\LeadFactoryInterface;
use Darvin\Bitrix24Bundle\Model\CRM\ProductRow;
use Darvin\Bitrix24Bundle\Request\Command\Factory\CRM\LeadCommandFactoryInterface;
use Darvin\Bitrix24Bundle\Request\Request;

public function __construct(
    ClientInterface $client,
    LeadCommandFactoryInterface $leadCommandFactory,
    LeadFactoryInterface $leadFactory
) {
    $this->client = $client;
    $this->leadCommandFactory = $leadCommandFactory;
    $this->leadFactory = $leadFactory;
}

$request = new Request();
$request->addCommand($this->leadCommandFactory->createAddCommand($this->leadFactory->createLead('test')));
$request->addCommand($this->leadCommandFactory->createSetProductRowsCommand(new ProductRow(1)));

$result = $this->client->send($request);