PHP code example of dompie / keila-php-api

1. Go to this page and download the library: Download dompie/keila-php-api 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/ */

    

dompie / keila-php-api example snippets




$httpClient = new \GuzzleHttp\Client();
$client = new \Dompie\KeilaApiClient\ApiClientV1($httpClientInterface, 'https://keila-installation.url', 'my-secret-keila-api-key');
$responseInterface = $client->createContact([
    'first_name' => 'First',
    'last_name' => 'Last',
    'email' => '[email protected]',
]);

$campaign = new \Dompie\KeilaApiClient\Campaign();
$campaign->withName('My test campaign')
    ->withTextEditor('Hello world!')
    ->withMarkdownEditor();
    
$responseInterface = $client->createCampaign($campaign);

$response = \Dompie\KeilaApiClient\KeilaResponse::new($responseInterface);
$response->hasData();
$response->getDataItem(0); //First element from the data property
$response->getGuzzleResponse()->getStatusCode()
xml
<env name="KEILA_BASE_URI" value="http://keila.local:4000" force="true"/>
<env name="KEILA_API_KEY" value="secret-api-key" force="true"/>