定制 guym4c/ghost-api-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

guym4c/ghost-api-php

Composer 安装命令:

composer require guym4c/ghost-api-php

包简介

PHP Ghost API client

README 文档

README

Easy pulling of content from a Ghost API.

Installation

composer require guym4c/ghost-api-php

Usage

Get an instance of the API client:

$ghost = new Ghost(
    $yourGhostApiBaseUrl,
    $yourGhostApiKey,
);

You can also pass in a Doctrine Cache provider here (and configure its lifetime), and the client will cache all requests that give a single-resource answer.

Call static methods on the resource classes to get your data.

use Guym4c\GhostApiPhp\Model as Cms;

Cms\Post::bySlug($ghost, 'my-post-slug');
Cms\Tag::byId($ghost, 'my-tag-id');
Cms\Page::get()

If you don't know the slug or ID of the resource you're looking for, you can also run queries. (You'll probably want to be reading Ghost's API docs in parallel if you use this method, so that you know what the client is doing.)

Cms\Page::get(
    /* limit: */ 5,
    /* simple sorting: */ new Sort('some_value', SortOrder::DESC),
);

get() returns a CollectionRequest that exposes methods for managing pagination - you can access the returned records using getResources().

Filtering

The third parameter to the ::get method above is a Ghost NQL filter, assembled programmatically using the client. It provides fluent methods that allow you to construct complex filter expressions.

(new Filter())
    ->by('some-val', '=', 'true', true)
    ->and('another-val', '-', 'not-this')
    ->else((new Filter())
        ->by(
            'this-filter-will-be-given-brackets',
            '=',
            'which-overrides-operator-precedence',
        )
    );

with() and else() are bracket-ised versions of and() and or(). You must start with by().

We've passed an additional true at the start here to denote that the value, 'true', is a literal and should be interpreted by Ghost as a boolean, not a string.

[] in-group syntax is not supported by the client.

Refer to the Ghost docs for more information on NQL filtering.

guym4c/ghost-api-php 适用场景与选型建议

guym4c/ghost-api-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「Ghost」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 guym4c/ghost-api-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 guym4c/ghost-api-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 guym4c/ghost-api-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-06