postmypost/php-rest-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

postmypost/php-rest-sdk

最新稳定版本:1.0.4

Composer 安装命令:

composer require 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.

README 文档

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 GuzzleHttp\Client;
use Postmypost\RestSdk\Api\PublicationsApi;
use Postmypost\RestSdk\Configuration;
use Postmypost\RestSdk\Model\CreatePublicationRequest;
use Postmypost\RestSdk\Model\PublicationDetailEditRequest;
use Postmypost\RestSdk\Model\PublicationDetailPublicationTypeEnum;
use Postmypost\RestSdk\Model\PublicationStatusEnumEdit;

// Set your API access token and project ID
$accessToken = 'YOUR_ACCESS_TOKEN';
$projectId = 123456;

// Set up HTTP client and configuration
$client = new Client();
$config = Configuration::getDefaultConfiguration()->setAccessToken($accessToken);
$publicationsApi = new PublicationsApi($client, $config);

// Build the publication request object
$publicationRequest = new CreatePublicationRequest([
    'project_id' => $projectId,
    'post_at' => new DateTime('2025-06-30T12:00:00+00:00'), // Publication time (UTC)
    'account_ids' => [111111, 222222], // Example account IDs
    'publication_status' => PublicationStatusEnumEdit::NUMBER_PENDING_PUBLICATION,
    'details' => [
        new PublicationDetailEditRequest([
            'account_id' => 111111,
            'publication_type' => PublicationDetailPublicationTypeEnum::NUMBER_POST,
            'content' => 'Check out our new product launch! #newproduct #launch',
            'file_ids' => [42516053],
        ]),
        new PublicationDetailEditRequest([
            'account_id' => 222222,
            'publication_type' => PublicationDetailPublicationTypeEnum::NUMBER_POST,
            'link' => 'https://example.com/new-product',
        ]),
    ]
]);

try {
    $response = $publicationsApi->createPublication($publicationRequest);
    echo "Publication created successfully!\n";
    echo "  Publication ID: " . $response->getId() . "\n";
} catch (Exception $e) {
    echo "Error while creating publication: ", $e->getMessage(), PHP_EOL;
}

See more examples in the examples folder and in the documentation.

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

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固