PHP code example of yudu / publisher

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

    

yudu / publisher example snippets



    
Publisher\Publisher;

// YUDU Publisher Credentials
$key = 'your-key-here';
$secret = 'your-secret-here';

// Optional
$options = [
    'debug' => false,    // raw requests/response returned for debugging
    'verify' => true,    // toggle SSL verification 
];

// Create Publisher Client
$publisher = new Publisher($key, $secret, $options);  

// Makes request for readers
$results = $publisher->getReaders();

// Print the result object (see responses section for how to manage responses) 
print_r($results);
    

$publisher->updatePermission(132365, [
    'expiryDate' => '2024-06-01T00:00:00Z'
]);

$publisher->updateSubscriptionPeriod(2351346 [
    'startDate'    => '2020-01-11T00:00:00Z',
    'expiryDate'   => '2021-01-11T00:00:00Z',
]);

$publisher->updateCategory([
    'categoryTitle'     => 'Do you remember the time?',
    'code'              => 'adventure',
    'containsAll'       => 'true',
    'defaultCategory'   => 'false',
    'ordering'          => '4',
    'publicationNodeId' => '61',
]);

$results = $publisher->method("GET")->resource("readers")->make();