PHP code example of arungpisyadi / sibex

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

    

arungpisyadi / sibex example snippets


    use ArungPIsyadi\SiBex\SiBex;

    // These values is better kept save on .env file.
    $sibex = new SiBex(SIB_API_TYPE, SIB_API_KEY); // either "api-key" or "partner-key", your SendInBlue API key.

    # Account function.
    dump($account = $sibex->getAccount());
    dump('email: '.$account['email']); // there are other return parameters that you can check your self.

    # Contact function.
    // get your lists
    dump($sibex->getLists($limit, $offset));

    // create a new list.
    dump($this->sibex->createList());

    // add a new email address as our contact in SendInBlue.
    $request->email = '[email protected]';
    dump($sibex->createContact($request->email));

    // add a contact based on email to a certain list.
    $added = $sibex->addContactToList($list_id, $emails); // $list_id must be an integer, $emails is a separated by comma string.
    dump($added);

    //Get contacts from a list.
    $contacts = $sibex->getContactsFromList($list_id);
    dump($contacts);