PHPackages                             robinscholz/better-rest - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. robinscholz/better-rest

ActiveKirby-plugin[HTTP &amp; Networking](/categories/http)

robinscholz/better-rest
=======================

Kirby Plugin for better REST requests

1.3(4y ago)525063[5 PRs](https://github.com/robinscholz/better-rest/pulls)MITPHPPHP &gt;=7.3.0

Since Aug 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/robinscholz/better-rest)[ Packagist](https://packagist.org/packages/robinscholz/better-rest)[ RSS](/packages/robinscholz-better-rest/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (12)Used By (0)

🤝 Better REST
=============

[](#-better-rest)

[![Release](https://camo.githubusercontent.com/d845f1e4ee5fe945f018129889c6dae0a9a523352bb73c6d692faec3b4fc48d8/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d663238643161)](https://camo.githubusercontent.com/d845f1e4ee5fe945f018129889c6dae0a9a523352bb73c6d692faec3b4fc48d8/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d663238643161)[![Stars](https://camo.githubusercontent.com/73e5d57dd6475802de363a6d2623e01bed63a03c11a4be89bc626a470815399e/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f6768732f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d67726179)](https://camo.githubusercontent.com/73e5d57dd6475802de363a6d2623e01bed63a03c11a4be89bc626a470815399e/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f6768732f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d67726179)[![Downloads](https://camo.githubusercontent.com/5c66b4db225755913af375f81dc40ff5ba890730e78b69db647c9b7eef034e35/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d67726179)](https://camo.githubusercontent.com/5c66b4db225755913af375f81dc40ff5ba890730e78b69db647c9b7eef034e35/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d67726179)[![Issues](https://camo.githubusercontent.com/cb387cbd5419df55a282c7e7d1c855a7090396e36bdf267db581f4d1f071c4fa/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f6768692f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d79656c6c6f77)](https://camo.githubusercontent.com/cb387cbd5419df55a282c7e7d1c855a7090396e36bdf267db581f4d1f071c4fa/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f6768692f726f62696e7363686f6c7a2f6265747465722d726573743f636f6c6f723d79656c6c6f77)[![Build Status](https://camo.githubusercontent.com/f4224c4121056d5947966cc0008d4cfc6755aea259559bf12a866d98562f3cd3/68747470733a2f2f666c61742e62616467656e2e6e65742f7472617669732f726f62696e7363686f6c7a2f6265747465722d72657374)](https://travis-ci.com/robinscholz/better-rest)[![Coverage Status](https://camo.githubusercontent.com/a2ebabb97c72e1190d0f7e659826f0074a3e46847ff85a066b665d921de52660/68747470733a2f2f666c61742e62616467656e2e6e65742f636f766572616c6c732f632f6769746875622f726f62696e7363686f6c7a2f6265747465722d72657374)](https://coveralls.io/github/robinscholz/better-rest)[![Twitter](https://camo.githubusercontent.com/fdf3a646a6a48a0d0e3accdeab41429a811038920770d73de7ffc8dcde2e7921/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f747769747465722f526f62696e5363686f6c7a)](https://twitter.com/RobinScholz)[![Twitter](https://camo.githubusercontent.com/f5d175a8d5ecdb0186b93143316f7ed8c0f0cb5139696bcc03f663cc6f239be0/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f747769747465722f626e6f6d6569)](https://twitter.com/bnomei)

A [Kirby](https://getkirby.com) 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
----------

[](#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](https://github.com/getkirby/kql) plugin, the recent work of [Johann Schopplich](https://github.com/johannschopplich) or [Kirby Content Representations](https://getkirby.com/docs/guide/templates/content-representations).

Usage
-----

[](#usage)

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

### Authentification

[](#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](https://github.com/robinscholz/better-rest/blob/master/blueprints/users/betterrest.yml). Read more about [user roles in the docs](https://getkirby.com/docs/guide/users/roles).

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

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

```

### Kirby 3 API

[](#kirby-3-api)

Examples:

- `rest/pages/:id` :
- `rest/site` :
- `rest/users/:id` :

> [Official Kirby 3 API docs](https://getkirby.com/docs/reference/api/)

### Better-Rest Settings from Query

[](#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

[](#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
--------

[](#settings)

### Config File

[](#config-file)

- The plugin converts *kirbytags* to HTML and adds a `srcset` to images by default.
- Additionally it is possible to enable [smartypants](https://michelf.ca/projects/php-smartypants/).
- To overwrite the default language it is possible to set a language code.

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

SettingsDefaultOptionskirbytags`true``boolean`smartypants`false``boolean`srcset`[375, 667, 1024, 1680]``Array` or `false`language`null``null` or `string`Caveats
-------

[](#caveats)

### HTTPS

[](#https)

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

### Local setup

[](#local-setup)

For local development use [Laravel Valet](https://laravel.com/docs/master/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
------------

[](#installation)

### Download

[](#download)

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

### Composer

[](#composer)

```
composer require robinscholz/better-rest

```

### Git submodule

[](#git-submodule)

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

```

Credits
-------

[](#credits)

A big thanks to [@bnomei](https://github.com/bnomei) who refactored the initial source code into something extendable and future proof. If you are using this plugin please consider [buying him a ☕](https://buymeacoff.ee/bnomei)!

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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 ~107 days

Recently: every ~160 days

Total

7

Last Release

1814d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

1.3PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3fa41b4e583599312d5ed21bbc1bdafc798e4b494ebbfeaffdcb23fc6ddadca7?d=identicon)[robinscholz](/maintainers/robinscholz)

---

Top Contributors

[![bnomei](https://avatars.githubusercontent.com/u/3265642?v=4)](https://github.com/bnomei "bnomei (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![kms-ploi](https://avatars.githubusercontent.com/u/102579258?v=4)](https://github.com/kms-ploi "kms-ploi (5 commits)")[![lucasdinonolte](https://avatars.githubusercontent.com/u/1673742?v=4)](https://github.com/lucasdinonolte "lucasdinonolte (1 commits)")[![moritzebeling](https://avatars.githubusercontent.com/u/39742729?v=4)](https://github.com/moritzebeling "moritzebeling (1 commits)")

---

Tags

apicmsheadlessjsonkirbykirbycmskirbytagkirbytagsmarkdownrestsrcsetjsonapirestmarkdowncmsheadlesssrcsetkirbykirby3kirby3-pluginkirby3-cmskirbycmskirbytagkirbytags

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/robinscholz-better-rest/health.svg)

```
[![Health](https://phpackages.com/badges/robinscholz-better-rest/health.svg)](https://phpackages.com/packages/robinscholz-better-rest)
```

###  Alternatives

[getkirby/kql

Kirby Query Language

15124.3k](/packages/getkirby-kql)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69114.3k](/packages/serpapi-google-search-results-php)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)[jsor/hal-client

A lightweight client for consuming and manipulating Hypertext Application Language (HAL) resources.

2425.9k1](/packages/jsor-hal-client)[elao/json-http-form-bundle

Adds support of JSON requests for Forms

356.0k](/packages/elao-json-http-form-bundle)

PHPackages © 2026

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