PHP code example of dotzero / laravel-amocrm

1. Go to this page and download the library: Download dotzero/laravel-amocrm 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/ */

    

dotzero / laravel-amocrm example snippets


'providers' => [
    // ...
    Dotzero\LaravelAmoCrm\AmoCrmServiceProvider::class,
],

'aliases' => [
    // ...
    'AmoCrm' => Dotzero\LaravelAmoCrm\Facades\AmoCrm::class,
],

use Dotzero\LaravelAmoCrm\AmoCrmManager;

Route::get('/', function (AmoCrmManager $amocrm) {
    try {

        /** @var \AmoCRM\Client $client */
        $client = $amocrm->getClient();
        $account = $client->account;

        // или

        /** @var \AmoCRM\Models\Account $account */
        $account = $amocrm->account;

        dd($account->apiCurrent());

    } catch (\Exception $e) {
        abort(400, $e->getMessage());
    }
});

use Dotzero\LaravelAmoCrm\Facades\AmoCrm;

Route::get('/', function () {

    /** @var \AmoCRM\Client $client */
    $client = AmoCrm::getClient();

    /** @var \AmoCRM\Helpers\Fields $fields */
    $fields = AmoCrm::getFields();

    /** @var \AmoCRM\Helpers\getB2BFamily $fields */
    $b2bfamily = AmoCrm::getB2BFamily();

});
bash
$ php artisan vendor:publish