PHP code example of mediumart / intercom

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

    

mediumart / intercom example snippets


Mediumart\Intercom\IntercomServiceProvider::class

'Intercom' => Mediumart\Intercom\Intercom::class

use Mediumart\Intercom\Client;

/** 
* Manually resolving from the container 
* */
$intercom = app('intercom');
// or
$intercom = app(Client::class);


/** 
* using type hinting and laravel's automatic resolution
* */
public function index(Client $intercom) 
{
    /.../
}


/**
* Simply leverage the facade
* */
$intercomUsers = Intercom::users();

// facade
$leads = Intercom::leads();

// instance
$intercom = app('intercom');
$conversations = $intercom->conversations();

$conversations = $intercom->conversations;

// facade
Intercom::macro('usersEmails', function () {
   return // your logic here ... 
});

// instance
$intercom->macro('usersEmails', function () use ($intercom) {
   return // your logic here ... 
});

// facade
$userEmails = Intercom::usersEmails();

// instance
$userEmails = $intercom->usersEmails();