PHPackages                             presshub-io/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. presshub-io/php-sdk

ActiveLibrary[Framework](/categories/framework)

presshub-io/php-sdk
===================

Presshub PHP SDK. Content distribution API for publishers.

1.4(9y ago)6131MITPHPPHP &gt;=5.6

Since Oct 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/presshub-io/php-sdk)[ Packagist](https://packagist.org/packages/presshub-io/php-sdk)[ Docs](https://github.com/presshub-io/php-sdk)[ RSS](/packages/presshub-io-php-sdk/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

Presshub PHP SDK
================

[](#presshub-php-sdk)

`Presshub\Template` is a PHP library that helps construct templates in the [Presshub Template format](https://www.presshub.io/docs/v1/templates)

`Presshub\Client` is a PHP library that allows you to distribute content to third-party content platforms via Presshub API. You can also retrieve and delete articles you’ve already published, and get basic information about your published articles, information about supported services and more.

Presshub [API Reference](https://www.presshub.io/docs/)

Installation
------------

[](#installation)

```
composer require presshub-io/php-sdk
```

or

```
git clone git@github.com:presshub-io/php-sdk.git
cd php-sdk
curl -sS https://getcomposer.org/installer | php
./composer.phar install
```

Presshub Template
-----------------

[](#presshub-template)

This example shows how to build Presshub template and map template fields.

```
// Create Presshub template.
$template = Presshub\Template::create()
  ->setTitle('Your Article Title')
  ->setSubTitle('Your Article Subtitle')
  ->setCanonicalURL( 'http://example.com/your-article-url.html' )
  ->setThumbnail( 'https://example.com/article-thumbnail.jpg' )
  ->setKeywords(['Keyword1', 'Keyword2', 'Keyword3'])
  ->setTemplate( 'basic' )
  ->addComponent(
    Presshub\Template\Component::create()
      ->setMap('category')
      ->setValue('Test Category')
      ->setProps()
  )
  ->addComponent(
    Presshub\Template\Component::create()
      ->setMap('byline')
      ->setValue('By Author Name')
      ->setProps()
  )
  ->addComponent(
    Presshub\Template\Component::create()
      ->setMap('featured_image')
      ->setValue('URL')
      ->setProps([
        'Caption'      => 'Image caption',
        'Photographer' => 'Photo by Name',
      ])
  )
  ->addComponent(
    Presshub\Template\Component::create()
      ->setMap('body')
      ->setValue('HTML content')
      ->setProps()
  );
```

Presshub Client
---------------

[](#presshub-client)

```
$api_key_id = "YOUR_PRESSHUB_API_KEY";

// maximum amount of time in seconds to which the execution of individual
// cURL extension function calls will be limited. Note that the value
// for this setting should include the value for $connect_timeout.
$timeout = 400;

// Maximum amount of time in seconds that is allowed to make the connection
// to the server. It can be set to 0 to disable this limit,
// but this is inadvisable in a production environment.
$connect_timeout = 0;

// Defaults to https://api.presshub.io/v1 However in some cases we create
// separate servers for premium clients.
$endpoint = "https://api.presshub.io/v1";

// Initialize Presshub Client object.
$client = new Presshub\Client($api_key, $timeout, $connect_timeout, $endpoint);
```

##### Preview Article

[](#preview-article)

```
// Generate previewable files, more services can be added.
// Please follow example: 'FacebookIA' => []
$result = $client->setTemplate($template)
  ->setServices([
      'AppleNews' => [],
      'Twitter'   => [
        // When empty article title will be used.
        "message" => "This is how you could override the title"
      ]
  ])
  ->preview()
  ->execute();

var_dump($result);
```

##### Publish Article

[](#publish-article)

```
// Publish article to AppleNews and Twitter.
// More can be added. See Get Services callback.
// $template - is a Presshub Template object. See above for an example.
$result = $client->setTemplate($template)
  ->setServices([
      'AppleNews' => [],
      'Twitter'   => [
        // When empty article title will be used.
        "message" => "This is how you could override the title",
        // Specify images - up to 5 supported.
        "media"   => [
          "https://images.unsplash.com/photo-1451153378752-16ef2b36ad05?dpr=1&auto=format&fit=crop&w=1500&h=1004&q=80&cs=tinysrgb&crop=",
          "https://images.unsplash.com/photo-1480129043491-6d5a4785b65c?dpr=1&auto=format&fit=crop&w=1500&h=1280&q=80&cs=tinysrgb&crop="
        ],
      ]
  ])
  ->publish()
  ->execute();

var_dump($result);
```

##### Update Article

[](#update-article)

```
// Update article in AppleNews and Twitter
// Please note not all services support update operation via API.
$result = $client->setTemplate($template)
  ->setServices([
      'AppleNews' => [],
      'Twitter'   => [
        // When empty article title will be used.
        "message" => "This is how you could override the title"
      ]
  ])
  // Presshub publication ID.
  ->update('POST_ID')
  ->execute();

var_dump($result);
```

##### Delete Article

[](#delete-article)

```
// Delete article from AppleNews and Twitter
// Please note not all services support delete operation via API.
$result = $client->setServices([
      'AppleNews' => [],
      'Twitter'   => []
  ])
  ->delete('POST_ID')
  ->execute();

var_dump($result);
```

See `examples` directory for more code examples.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

5

Last Release

3497d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8600103?v=4)[presshub](/maintainers/presshub)[@presshub](https://github.com/presshub)

---

Top Contributors

[![minnur](https://avatars.githubusercontent.com/u/4031934?v=4)](https://github.com/minnur "minnur (15 commits)")

---

Tags

apple-newsapple-news-formatarticlefacebookfacebook-instant-articlesinstagramlinkedinlivejournalmediumphp-libraryphp-sdkpinterestpresshub-templateslacktumblrvkontaktehttpphpjsonapiclientframeworkrestweb servicemediasocialrestful newssocial mediarequestspress

### Embed Badge

![Health badge](/badges/presshub-io-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/presshub-io-php-sdk/health.svg)](https://phpackages.com/packages/presshub-io-php-sdk)
```

###  Alternatives

[php-curl-class/php-curl-class

PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.

3.4k9.9M373](/packages/php-curl-class-php-curl-class)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.5k](/packages/ismaeltoe-osms)[patricksavalle/slim-rest-api

Production-grade REST-API App-class for PHP SLIM, in production on https://zaplog.pro (https://api.zaplog.pro/v1)

101.4k](/packages/patricksavalle-slim-rest-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
