PHP code example of podio-labs / podio-client

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

    

podio-labs / podio-client example snippets


use Podio\Client\PodioClient;

$podio = PodioClient::factory()
    ->withClientCredentials($clientId, $clientSecret)
    ->withPasswordAuth($username, $password)
    ->make();

$item = $podio->items()->create($appId, [
    'fields' => ['title' => 'New lead'],
]);

use Podio\Client\PodioClient;

$podio = PodioClient::factory()
    ->withClientCredentials($clientId, $clientSecret) // rl('https://api.podio.com')            // optional
    ->withTokenCache($cache)                          // optional (PSR-16)
    ->withHttpClient($client)                         // optional (PSR-18)
    ->make();

$token = $podio->authenticate(); // ensure a valid token and return it
$token = $podio->token();        // current token

$token->value();
$token->expiresAt();
$token->refreshToken();

// Items
$item = $podio->items()->get($itemId);
$item = $podio->items()->create($appId, ['fields' => ['title' => 'Hello']]);
$item = $podio->items()->update($itemId, ['fields' => ['title' => 'Updated']]);
$total = $podio->items()->getCount($appId);

// Files
$file = $podio->files()->upload($absolutePath, 'photo.jpg');
$podio->files()->attach($file->file_id, ['ref_type' => 'item', 'ref_id' => $itemId]);
$bytes = $podio->files()->getRaw($fileId);

// Comments
$podio->comments()->create('item', $itemId, ['value' => 'Imported from Dropbox']);

// Embeds
$embed = $podio->embed()->create(['url' => 'https://youtu.be/...']);

// Webhooks
$hooks = $podio->hooks()->getForApp($appId);
$hook = $podio->hooks()->createForApp($appId, ['url' => 'https://example.com/hook', 'type' => 'item.create']);
$podio->hooks()->verify($hook->hook_id);

// Organizations
$organizations = $podio->organizations()->getAll();
$organization = $podio->organizations()->get($orgId);

// Spaces
$space = $podio->spaces()->get($spaceId);

// Apps
$app = $podio->apps()->get($appId);
$apps = $podio->apps()->getForSpace($spaceId);

$response = $podio->send('GET', '/item/123', ['raw' => true]);

$response->statusCode();
$response->body();
$response->rateLimit();

$podio->rateLimit()->limit();
$podio->rateLimit()->remaining();

$podio = PodioClient::factory()
    ->withClientCredentials('id', 'secret')
    ->withPasswordAuth('user', 'pass')
    ->withHttpClient($stubPsr18Client)
    ->make();