PHP SDK
Official PHP SDK for PHP 7.4+
Installation
composer require content-hub/sdk
Requires PHP 7.4 or higher and Composer.
Quick Start
<?php
use ContentHub\Client;
$hub = new Client(['apiKey' => 'YOUR_API_KEY']);
// List domains
$domains = $hub->domains()->list();
print_r($domains);
// Create content
$content = $hub->content()->create([
'title' => 'My Article',
'content' => 'Article content',
'domain' => 'example.com'
]);
print_r($content);
?>Working with Domains
<?php
// List all domains
$domains = $hub->domains()->list();
// Get a specific domain
$domain = $hub->domains()->get('example.com');
// Create a new domain
$newDomain = $hub->domains()->create([
'name' => 'newdomain.com'
]);
// Update domain settings
$hub->domains()->update('example.com', [
'settings' => [ /* ... */ ]
]);
?>Working with Content
<?php
// List content
$content = $hub->content()->list([
'domain' => 'example.com',
'limit' => 20
]);
// Get specific content
$item = $hub->content()->get('content-id');
// Create content
$newContent = $hub->content()->create([
'title' => 'New Article',
'content' => 'Content here',
'domain' => 'example.com'
]);
// Update content
$hub->content()->update('content-id', [
'title' => 'Updated Title'
]);
// Delete content
$hub->content()->delete('content-id');
?>Documentation
For complete documentation and API reference, visit: