PHP code example of podio-labs / podio-laravel

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


use Podio\Laravel\Facades\Podio;

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

Podio::comments()->create('item', $item->item_id, [
    'value' => 'Created from the contact form',
]);

$token = Podio::authenticate(); // ensure a valid token and return it
$token = Podio::token();        // current token, or null

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

use Podio\Laravel\Facades\Podio;

// 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' => route('podio.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();

Http::fake([
    'api.podio.com/oauth/token' => Http::response(['access_token' => 'test', 'expires_in' => 3600]),
    'api.podio.com/item/*' => Http::response(['item_id' => 1]),
]);
bash
php artisan vendor:publish --tag=podio-config