PHP code example of ipalaus / buffer-php-sdk

1. Go to this page and download the library: Download ipalaus/buffer-php-sdk 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/ */

    

ipalaus / buffer-php-sdk example snippets


use Ipalaus\Buffer\Client;
use Ipalaus\Buffer\TokenAuthorization;

$auth = new TokenAuthorization('access_token');

$client = new Client($auth);

$user = $client->getUser();

$profiles = $client->getProfiles();

$client->getProfile($id);

$client->getProfileSchedules($id);

use Ipalaus\Buffer\Schedule;

$schedule = new Schedule;

// you can pass a single string or an array
$schedule->addDay('mon');
$schedule->addDay(array('tue', 'wed')); 

// same for time
$schedule->addTime('09:00');
$schedule->addTime(array('12:00', '15:00')); 

$client->updateProfileSchedules('id', $schedule);

// alternative syntax, even shorter
$schedule = new Schedule(array('mon', 'tue', 'wed'), array('09:00', '12:00', '15:00'));
$client->updateProfileSchedules($id, $schedule);

// multiple schedules
$weekdays = new Schedule(array('mon', 'tue', 'wed', 'thu', 'fri'), array('09:00', '12:00', '16:00');
$weekends = new Schedule(array('sat', 'sun'), array('12:00', '18:00');

$client->updateProfileSchedules($id, array($weekdays, $weekends));

$client->getUpdate('id');

$client->getProfilePendingUpdates('id');

// optional parameters
$client->getProfilePendingUpdates($id, $page = null, $count = null, $since = null, $utc = false)

$client->getProfileSentUpdates($id);

// optional parameters
$client->getProfileSentUpdates($id, $page = null, $count = null, $since = null, $utc = false);

$client->getUpdateInteractions($id);

// optional parameters
$client->getUpdateInteractions($id, $page = null, $count = null, $event = null);

$client->reorderProfileUpdates($id, array($update1, $update3, $update5));

// optional parameters
$client->reorderProfileUpdates($id, $order, $offset = null, $utc = false)

$client->shuffleProfileUpdates($id);

// optional parameters
$client->shuffleProfileUpdates($id, $count = null, $utc = false);

use Ipalaus\Buffer\Update;

$update = new Update;

$update->text = 'Check out my website!';
$update->addProfile($id);

$update->shorten = 'false'; // optional, default: true 
$update->now = 'false'; // optional, default: true
$update->top = 'true'; // optional, default: false
$update->attachment = 'false'; // optional, default: true

// adding media is optional, available options: link, description, picture, thumbnail
$update->addMedia('link', 'http://ipalaus.com');
$update->addMedia('description', 'Isern Palaus personal website.');
$update->addMedia('picture', 'http://ipalaus.com/img/isern-palaus_smile.jpg');
$update->addMedia('thumbnail', 'http://ipalaus.com/img/isern-palaus_smile.jpg'); // 

$update = new Update;
$update->text = 'Lorem ipsum'; // 

$client->shareUpdate($id);

$client->destroyUpdate($id);

$client->moveUpdateToTop($id);

$client->getLinkShares('http://ipalaus.com');

$client->getConfigurationInfo();

use Ipalaus\Buffer\Button;

// available count styles: vertical, horizontal or none
echo Button::create('vertical');

// our even simpler
echo Button::vertical();

// optional parameters
Button::create($style, $tweet = null, $url = null, $username = null, $picture = null);
 json
{
    "alaus/buffer-php-sdk": "1.1.*"
    }
}