Any media_urls (or media_ids) entry can also be an array carrying per-media
alt text (max 1500 chars), delivered to Mastodon, Bluesky, X (photos/GIFs), and
Pinterest:
Code
'media_urls' => [['url' => 'https://example.com/teaser.jpg', 'alt' => 'Red sneaker on a white background']],
Publish immediately:
Code
$client->posts->createAndPublish([ 'content' => 'Going live right now', 'channels' => ['x', 'bluesky'],]);
// From a path$client->media->upload(['file' => './photos/product.jpg', 'name' => 'product-hero']);// Or from raw bytes (pass a filename so the API can detect the type)$bytes = file_get_contents('./photos/product.jpg');$client->media->upload(['file' => $bytes, 'filename' => 'product.jpg']);
Analytics
Code
// One post's latest per-platform metrics$stats = $client->analytics->post('post_id');print_r($stats['data']['platforms']['instagram']['metrics'] ?? null);// Batch: up to 100 posts in one call$batch = $client->analytics->posts(['id1', 'id2', 'id3']);// Workspace-wide overview$overview = $client->analytics->overview(['period' => '30d']);echo $overview['data']['total_impressions'] . ' ' . $overview['data']['total_engagements'];// Account-level stats (followers etc)$accountStats = $client->analytics->accounts(['platform' => 'instagram']);
Social Inbox
The PHP SDK also covers the Social Inbox (cursor-paginated):
The base class is OmniSocials\Exception\OmniSocialsException. ApiException
exposes getStatus(), getErrorCode(), getMessage(), and getBody(). Types:
ValidationException (400/422), AuthenticationException (401),
PermissionDeniedException (403), NotFoundException (404), RateLimitException
(429, getRetryAfter()), ServerException (5xx), ApiConnectionException, and
WebhookVerificationException.