### Install laravel-buffer via Composer Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Install the package via Composer. ```bash composer require jeffersongoncalves/laravel-buffer ``` -------------------------------- ### Get Buffer API configuration Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Retrieve API configuration information. ```php // GET /info/configuration.json $config = Buffer::info(); ``` -------------------------------- ### Mock Buffer API in a Pest test Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Example Pest test that mocks the Buffer API using Http::fake and verifies the list() method returns the expected data. ```php use Illuminate\Support\Facades\Http; use JeffersonGoncalves\Buffer\Facades\Buffer; it('lists profiles', function () { Http::fake(['*/profiles.json' => Http::response([['id' => 'p1']])]); $result = Buffer::profiles()->list(); expect($result[0]['id'])->toBe('p1'); }); ``` -------------------------------- ### Updates management Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Manage updates: get, pending, sent, create, update, share, destroy, and shuffle. The pending method accepts optional page and count parameters; sent accepts an optional since timestamp. ```php // GET /updates/{id}.json $update = Buffer::updates()->get('4eb8ab585208912e5f000005'); // GET /profiles/{id}/updates/pending.json — page, count and since are optional $pending = Buffer::updates()->pending('4eb854340acb04e870000005', page: 1, count: 10); // GET /profiles/{id}/updates/sent.json $sent = Buffer::updates()->sent('4eb854340acb04e870000005', since: now()->subWeek()->timestamp); // POST /updates/create.json Buffer::updates()->create( profileIds: ['4eb854340acb04e870000005'], text: 'Scheduled from Laravel!', scheduledAt: '2026-01-01 12:00:00', now: false, top: false, shorten: false, ); // POST /updates/{id}/update.json Buffer::updates()->update('4eb8ab585208912e5f000005', 'Updated text', '2026-01-02 09:00:00'); // POST /updates/{id}/share.json Buffer::updates()->share('4eb8ab585208912e5f000005'); // POST /updates/{id}/destroy.json Buffer::updates()->destroy('4eb8ab585208912e5f000005'); // POST /profiles/{id}/updates/shuffle.json Buffer::updates()->shuffle('4eb854340acb04e870000005'); ``` -------------------------------- ### List and fetch profiles and schedules Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Demonstrates listing profiles, fetching a single profile, and retrieving its schedules using the ProfileResource methods. ```php $profiles = Buffer::profiles()->list(); $profile = Buffer::profiles()->get($profiles[0]['id']); $schedules = Buffer::profiles()->schedules($profile['id']); ``` -------------------------------- ### Import Buffer facade Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Import the Buffer facade or resolve the manager from the container. All methods return decoded JSON as an array or throw a BufferException on failed responses. ```php use JeffersonGoncalves\Buffer\Facades\Buffer; // or resolve the manager from the container: app(\JeffersonGoncalves\Buffer\Buffer::class) ``` -------------------------------- ### Access Buffer resources via the Buffer facade Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Shows the entry point for the laravel-buffer package: the Buffer facade exposes one method per resource group, each returning a resource object except info() which returns an array. ```php use JeffersonGoncalves\Buffer\Facades\Buffer; Buffer::user(); // UserResource Buffer::profiles(); // ProfileResource Buffer::updates(); // UpdateResource Buffer::info(); // array — GET /info/configuration.json (no dedicated resource, single call) ``` -------------------------------- ### Run tests with Composer Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Run the package test suite. ```bash composer test ``` -------------------------------- ### Publish buffer-config Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Publish the package configuration file. ```bash php artisan vendor:publish --tag=buffer-config ``` -------------------------------- ### Run tests, PHPStan, and Pint Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Commands to run the test suite, static analysis, and code style checks for the package. ```bash vendor/bin/pest vendor/bin/phpstan analyse vendor/bin/pint ``` -------------------------------- ### Create, edit, share, delete, and shuffle updates Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Illustrates creating, updating, sharing, deleting, and shuffling updates. The now, top, and shorten flags are only sent as the string 'true' when true. ```php Buffer::updates()->create( profileIds: [$profileId], text: 'Hello world', scheduledAt: '2026-01-01 12:00:00', now: false, top: false, shorten: false, ); Buffer::updates()->update($updateId, 'New text', scheduledAt: null); Buffer::updates()->share($updateId); Buffer::updates()->destroy($updateId); Buffer::updates()->shuffle($profileId); ``` -------------------------------- ### Set BUFFER_ACCESS_TOKEN in .env Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Add your Buffer access token to the .env file. Generate one at buffer.com/developers/apps. ```bash BUFFER_ACCESS_TOKEN=your-access-token ``` -------------------------------- ### Fetch paginated updates with optional parameters Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Shows how to call pending() and sent() with optional page, count, and since parameters. Omitting any parameter leaves it out of the request entirely. ```php Buffer::updates()->pending($profileId); // no query params Buffer::updates()->pending($profileId, page: 2, count: 20); // ?page=2&count=20 Buffer::updates()->sent($profileId, since: now()->subDay()->timestamp); ``` -------------------------------- ### Published config file Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Contents of the published config file. It defines the access token and base URL from environment variables. ```php return [ 'access_token' => env('BUFFER_ACCESS_TOKEN', ''), 'base_url' => env('BUFFER_BASE_URL', 'https://api.bufferapp.com/1'), ]; ``` -------------------------------- ### Handle BufferException on API calls Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/resources/boost/skills/buffer-development/SKILL.md Shows how to catch BufferException when a call fails, e.g., due to a missing or invalid BUFFER_ACCESS_TOKEN. The errorBody() method provides the raw decoded error payload. ```php try { Buffer::user()->info(); } catch (\JeffersonGoncalves\Buffer\Exceptions\BufferException $e) { report($e); // $e->errorBody() has the raw decoded Buffer error payload. } ``` -------------------------------- ### Handle BufferException Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Handle Buffer API errors by catching BufferException. The exception provides the error message, HTTP status code, and full decoded error payload. ```php use JeffersonGoncalves\Buffer\Exceptions\BufferException; use JeffersonGoncalves\Buffer\Facades\Buffer; try { Buffer::user()->info(); } catch (BufferException $e) { // $e->getMessage() — the Buffer API error message // $e->getCode() — the HTTP status code // $e->errorBody() — the full decoded error payload } ``` -------------------------------- ### User info and deauthorize Source: https://github.com/jeffersongoncalves/laravel-buffer/blob/main/README.md Retrieve the authenticated user's info and deauthorize the user. ```php // GET /user.json $user = Buffer::user()->info(); // POST /user/deauthorize.json Buffer::user()->deauthorize(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.