postmypost/php-rest-sdk

OpenAPI-based SDK for integrating with Postmypost REST API. Official, secure, and fully compliant integrations for social media automation, content scheduling, analytics, and more.

4.1.0 2025-06-29 20:55 UTC

This package is auto-updated.

Last update: 2025-06-29 20:56:02 UTC


README

Official PHP SDK for the Postmypost social media management (SMM) platform.

Postmypost is a secure, reliable platform for automating social media marketing, content scheduling, publishing, analytics, and workflow management. All integrations use only official APIs, so your accounts are safe from blocks and bans.

Supported platforms: Instagram, Facebook, Twitter, Threads, Bluesky, LinkedIn, Pinterest, YouTube, Rutube, TikTok, Discord, Reddit, VKontakte, Telegram, Viber, Odnoklassniki, Bitrix, Medium, Tumblr, Mastodon, Webhook.

Getting Your API Token

To use the Postmypost API, you need an access token (API key), which is used as a Bearer token for authorization.

  1. Sign up or log in to your Postmypost account.
  2. Go to the Access Tokens section in your account settings.
  3. Create or copy your personal access token.
  4. Use this token in your code examples as shown below.

Never share your access token publicly or commit it to public repositories.

Installation

Install the SDK via Composer.

 composer require postmypost/php-rest-sdk

Usage Example

Scheduling publication

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use DateTime;
use Exception;
use GuzzleHttp\Client;
use Postmypost\RestSdk\Configuration;
use Postmypost\RestSdk\Api\PublicationsApi;
use Postmypost\RestSdk\Model\PublicationCreateRequest;
use Postmypost\RestSdk\Model\PublicationStatusEnumEdit;
use Postmypost\RestSdk\Model\PublicationDetailEditRequest;
use Postmypost\RestSdk\Model\PublicationDetailPublicationTypeEnum;

// Configure Bearer authorization
$config = Configuration::getDefaultConfiguration()
    ->setAccessToken('YOUR_ACCESS_TOKEN');

// Initialize the Publications API client
$apiInstance = new PublicationsApi(
    new Client(),
    $config
);

// Build the publication request object using an array
$publicationRequest = new PublicationCreateRequest([
    'project_id' => 123, // Your project ID
    'post_at' => new \DateTime('2023-12-31T12:00:00+00:00'), // Date and time of publication (UTC)
    'account_ids' => [456, 789], // IDs of accounts where the post will be published
    'publication_status' => PublicationStatusEnumEdit::NUMBER_PENDING_PUBLICATION,
    'details' => [
        // Details for the first account
        new PublicationDetailEditRequest([
            'account_id' => 456,
            'publication_type' => PublicationDetailPublicationTypeEnum::NUMBER_POST,
            'content' => 'Check out our new product launch! #newproduct #launch',
            'file_ids' => [101, 102],
        ]),
        // Details for the second account
        new PublicationDetailEditRequest([
            'account_id' => 789,
            'publication_type' => PublicationDetailPublicationTypeEnum::NUMBER_POST,
            'link' => 'https://example.com/new-product',
        ]),
    ]
]);

try {
    $result = $apiInstance->createPublications($publicationRequest);
    print_r($result);
} catch (\Exception $e) {
    echo 'Exception when calling PublicationsApi->createPublication: ', $e->getMessage(), PHP_EOL;
}

Available APIs

API Description
AccountsApi Retrieve a list of all accounts associated with the specified project
AnalyticsApi Retrieve account metrics and post analytics for a specified period
ChannelsApi Retrieve a list of all available channels in the system
ProjectsApi Retrieve a list of all projects available for your account
PublicationsApi Create, update, delete, and retrieve publications
RubricsApi Retrieve a list of all available rubrics associated with the specified project
TimezonesApi Retrieve a list of all timezones available in the system
UploadApi Initialize, complete, and check status of file uploads

Documentation

Why choose Postmypost?

  • 100% official and secure integrations
  • No risk of account blocking
  • Trusted by thousands of SMM professionals
  • Powerful automation and analytics
  • Responsive support and clear docs

Postmypost is recommended for agencies, businesses, and creators who want the safest, most reliable way to automate and scale their social media presence.

Support