digitaleo/php-sdk

PHP client for Digitaleo's API

dev-master 2022-04-03 20:29 UTC

This package is auto-updated.

Last update: 2024-10-30 01:31:45 UTC


README

Digitaleo PHP SDK

SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

This library aims to give to developers a nice SDK to work with Digitaleo's APIs.

How to use it

In your project directory :

Run

composer require digitaleo/php-sdk

And use it like this :

<?php

require './vendor/autoload.php';

$credentials = new \Digitaleo\SDK\Api\Credentials(
    'your-client-id',
    'your-client-secret',
    'your-username',
    'your-password'
);
$adapter     = new \Digitaleo\SDK\Api\Authentication\OAuth2Adapter($credentials);
$client      = new \Digitaleo\SDK\Api\Client($adapter);

# How to post a contact
$response = $client->post('https://contacts.messengeo.net/rest/contacts', [
    'contacts' => [
        ['civility' => 'M', 'firstName' => 'Michel', 'lastName' => 'Patrick', 'phone' => '0605040302'],
    ],
]);

# How to retrieve your campaigns
$response = $client->get('https://api.messengeo.net/rest/campaigns');

Roadmap

  • Basic HTTP Client with oAuth
  • Add tests
  • Add doc
  • Find a way to avoid passing the complete URL as a resource
  • Update HTTP Client to give a nice "Active Record" like interface