承接 robinscholz/better-rest 相关项目开发

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

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

robinscholz/better-rest

Composer 安装命令:

composer require robinscholz/better-rest

包简介

Kirby Plugin for better REST requests

README 文档

README

Release Stars Downloads Issues Build Status Coverage Status Twitter Twitter

A Kirby plugin that exposes the internal REST API at /rest with the option to convert Kirbytags to HTML and add a srcset to images in the process. Intended to convert Kirby into a headless CMS.

Disclaimer

While this plugin is still functional, quite a few alternatives exist for turning Kirby into a headless content management system. If you are looking for a more sophisticated and modern solution, please take a look at the Kirby Query Language plugin, the recent work of Johann Schopplich or Kirby Content Representations.

Usage

The API can be accessed at /rest. The plugin only allows GET requests.

Authentification

Requests need to be authenticated via Basic Auth. It’s recommended to create a seperate API User with either a custom blueprint or with the one provided by this plugin called better-rest API. Read more about user roles in the docs.

Basic Auth needs to be enabled in the site/config/config.php:

return [
    'api' => [
        'basicAuth' => true
    ]
];

Kirby 3 API

Examples:

Official Kirby 3 API docs

Better-Rest Settings from Query

All standard setting as well as settings defined in site/config/onfig.php can be overwritten on a per-request basis. Simply prefix the setting with br- and include it as a query.

Examples:

  • rest/pages/test?br-srcset=375,1200 : br-srcset
  • rest/pages/test?br-smartypants=1 : br-smartypants
  • rest/pages/test?br-language=fr : br-language
  • rest/pages/test?br-kirbytags=0&br-srcset=0 : br-kirbytag br-srcset

Multilang

The plugin supports multiple language settings. To fetch content for a specific language include a X-Language header containing the desired language code with your request. Alternatively a br-language query can be used.

Settings

Config File

  • The plugin converts kirbytags to HTML and adds a srcset to images by default.
  • Additionally it is possible to enable smartypants.
  • To overwrite the default language it is possible to set a language code.

All settings need to be prefixed with robinscholz.better-rest.!

Settings Default Options
kirbytags true boolean
smartypants false boolean
srcset [375, 667, 1024, 1680] Array or false
language null null or string

Caveats

HTTPS

The Kirby installation needs to be served with a TLS Certicificate via https.

Local setup

For local development use Laravel Valet or disable https in the site/config/config.php:

return [
  'api' => [
    'basicAuth' => true,
    'allowInsecure' => true
  ]
];

WARNING: Do not use this setting for production environments!

Installation

Download

Download and copy this repository to /site/plugins/better-rest.

Composer

composer require robinscholz/better-rest

Git submodule

git submodule add https://github.com/robinscholz/better-rest.git site/plugins/better-rest

Credits

A big thanks to @bnomei who refactored the initial source code into something extendable and future proof. If you are using this plugin please consider buying him a ☕!

License

MIT

robinscholz/better-rest 适用场景与选型建议

robinscholz/better-rest 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 506 次下载、GitHub Stars 达 52, 最近一次更新时间为 2019 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 robinscholz/better-rest 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 52
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-04