1. Go to this page and download the library: Download tillio-crm/oauth-resources 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/ */
$storage = $resources->storage();
// Zapis (upsert — pełne nadpisanie)
$storage->put('sync_state', 'wfirma', [
'last_run_at' => '2026-07-24T03:00:00Z',
'cursor' => 18234,
'status' => 'ok',
]);
// Odczyt
$doc = $storage->get('sync_state', 'wfirma'); // NotFoundException gdy brak
$doc = $storage->find('sync_state', 'wfirma'); // null gdy brak
echo $doc['data']['status']; // 'ok'
// Lista z filtrem i paginacją
$page = $storage->list('invoices', [
'limit' => 100,
'filter' => ['status', '==', 'pending'],
]);
$next = $storage->list('invoices', ['after' => $page['next_cursor']]);
// Iteracja po całej kolekcji (paginacja automatyczna)
foreach ($storage->all('invoices') as $invoice) {
// ...
}
// Usunięcie
$storage->delete('sync_state', 'wfirma');
$files = $resources->files();
// Upload / download w jednej linii
$files->upload('invoices/2026/07/faktura-123.pdf', $pdfBytes, 'application/pdf');
$pdf = $files->download('invoices/2026/07/faktura-123.pdf');
// Signed URL np. dla przeglądarki użytkownika (ważny 15 minut)
$grant = $files->downloadUrl('invoices/2026/07/faktura-123.pdf');
header('Location: ' . $grant['url']);
// Listing i kasowanie
$list = $files->list('invoices/2026/07/');
$files->delete('invoices/2026/07/faktura-123.pdf');
use TillioCrm\OAuth\Resources\Exception\NotFoundException;
try {
$doc = $resources->storage()->get('sync_state', 'wfirma');
} catch (NotFoundException) {
// pierwsza synchronizacja — brak stanu
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.