承接 publino/sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

publino/sdk

Composer 安装命令:

composer require publino/sdk

包简介

PHP client for the Publino headless delivery API.

README 文档

README

Zero-runtime-dependency PHP 8.2+ client for the Publino headless delivery API. Fetches published articles from a Publino site and returns typed DTOs.

📖 Full guide with framework examples (WordPress, Laravel): https://publino.de/sdk/php

Requirements

  • PHP 8.2 or later
  • ext-curl and ext-json (both bundled with standard PHP distributions)
  • Composer

Installation

composer require publino/sdk

Quick start

<?php
require_once 'vendor/autoload.php';

use Publino\Sdk\PublinoClient;

$client = new PublinoClient(
    baseUrl: 'https://api.publino.de',
    siteId:  'mein-blog',
    apiKey:  getenv('PUBLINO_API_KEY'), // secret key (pub_live_…) — server only
);

// List published articles → ArticleSummary[]
$articles = $client->articles('de');
foreach ($articles as $a) {
    echo $a->title, "", $a->readingMinutes, " min\n";
}

// Fetch a single article by "{slug}-{id}" or bare public id → ?Article
$article = $client->article('hallo-welt-ab12cd34', 'de');
if ($article !== null) {
    echo $article->html;
}

Security: the secret key (pub_live_…) must stay server-side. For browser usage, use the publishable key (pub_pub_…) with the embed.js web components.

API

new PublinoClient(string $baseUrl, string $siteId, string $apiKey, int $timeout = 10, ?Transport $transport = null)

$baseUrl is the API origin (e.g. https://api.publino.de); the client appends /v1/sites/{siteId}. Pass a custom Transport to use your own HTTP client; the default is a bundled cURL transport.

articles(?string $locale = null): ArticleSummary[]

Returns all published articles, newest first. $locale defaults to the site's primary locale.

article(string $id, ?string $locale = null): ?Article

Returns the full article for a public id (bare id or "{slug}-{id}"), or null on 404.

DTOs

ArticleSummary: id, title, slug, locale, excerpt, metaDescription, canonicalUrl, publishedAt, readingMinutes (all readonly properties).

Article: the summary fields plus markdown, html, jsonLdhtml is server-rendered and sanitized; jsonLd is ready-to-embed Schema.org data (or null).

Errors

All exceptions extend Publino\Sdk\Exception\PublinoException:

  • UnauthorizedException (401) — bad / missing key
  • RateLimitedException (429) — exposes retryAfter
  • ApiException — other non-2xx, exposes status
  • TransportException — network failure / invalid JSON
use Publino\Sdk\Exception\RateLimitedException;

try {
    $articles = $client->articles('de');
} catch (RateLimitedException $e) {
    // back off for $e->retryAfter seconds
}

Development

composer install
composer test   # phpunit

License

MIT © FameSystems GmbH & Co. KG

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固