PHP code example of donttrythisathome / crm-client

1. Go to this page and download the library: Download donttrythisathome/crm-client 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/ */

    

donttrythisathome / crm-client example snippets


$config = [
    'default' => 'baz',
    'drivers' => [
        'baz' => [
            'api_token' => $token, 
            'endpoint' => $endpoint          
        ]           
    ]
];
$data = ['foo' => 'bar'];

$crm = new \Donttrythisathome\CRMClient\CRMManager($config);

// send data using default driver
$crm->driver()->send($data);
// or
$crm->send($data)
 
// you can specify the CRM driver name 
$crm->driver('baz')->send($data);


use Donttrythisathome\CRMClient\CRMManager;
use Donttrythisathome\CRMClient\Facades\CRM;

...

protected CRMManager $crm;

/**
 * @param \Donttrythisathome\CRMClient\CRMManager $crm
 */
public function __construct(CRMManager $crm) {
    $this->crm = $crm;
}

/**
 * @param array $data
 */
public function foo(array $data) {
    // send data using default driver or specify driver with driver(string $driver)
    $this->crm->send($data);
    // or 
    CRM::send($data);
}