All Projects → robinscholz → better-rest

robinscholz / better-rest

Licence: MIT license
Kirby plugin for better REST requests

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to better-rest

kirby-membership
Simple Membership plugin for Kirby CMS
Stars: ✭ 27 (-47.06%)
Mutual labels:  kirby, kirbycms
react-kirby-starter
React boilerplate with headless Kirby API [WIP]
Stars: ✭ 23 (-54.9%)
Mutual labels:  kirby, headless
Cartkit
Cartkit - The [quick] starter kit!
Stars: ✭ 39 (-23.53%)
Mutual labels:  kirby, kirbycms
kirby-sortable
Making subpage managing a breeze
Stars: ✭ 82 (+60.78%)
Mutual labels:  kirby
kql
Kirby's Query Language API combines the flexibility of Kirby's data structures, the power of GraphQL and the simplicity of REST.
Stars: ✭ 120 (+135.29%)
Mutual labels:  kirby
monochrome
A fully responsive Kirby CMS theme
Stars: ✭ 27 (-47.06%)
Mutual labels:  kirby
cortex
📝 A headless, multitenant dynamic content platform powered by Rails, GraphQL and Elasticsearch
Stars: ✭ 28 (-45.1%)
Mutual labels:  headless
KirbyComments
[Kirby 2] File-based comments stored as subpages for the Kirby CMS.
Stars: ✭ 68 (+33.33%)
Mutual labels:  kirby
kirby-imageboxes
Add illustrations to Kirby's checkboxes. Kirby 2 and 3.
Stars: ✭ 33 (-35.29%)
Mutual labels:  kirby
nextjs-woocommerce-restapi
A React WooCommerce Project Example With REST API
Stars: ✭ 168 (+229.41%)
Mutual labels:  headless
rapidez
Headless Magento - with Laravel, Vue and Reactive Search 🚀
Stars: ✭ 31 (-39.22%)
Mutual labels:  headless
commercelayer-checkout
Commmerce Layer Checkout (Vue.js)
Stars: ✭ 31 (-39.22%)
Mutual labels:  headless
vaahcms
VaahCMS is a laravel based open-source web application development platform shipped with a headless content management system (CMS).
Stars: ✭ 56 (+9.8%)
Mutual labels:  headless
hfg-documentation-generator
The HfG Documentation Generator
Stars: ✭ 13 (-74.51%)
Mutual labels:  kirby
kirby-map-field
🗺 An easy way to use maps and location data in Kirby.
Stars: ✭ 41 (-19.61%)
Mutual labels:  kirby
seedpress-cms
A headless CMS built in Express for PostgresQL using Sequelize. Generally follows the Wordpress post and term schema.
Stars: ✭ 71 (+39.22%)
Mutual labels:  headless
awesome-medusajs
A curated list of awesome resources related to MedusaJS 😎
Stars: ✭ 113 (+121.57%)
Mutual labels:  headless
kirby-previewfiles
💪 A Kirby field to enable file thumbnail preview in the panel sidebar
Stars: ✭ 35 (-31.37%)
Mutual labels:  kirby
electric-webview
Electric WebView is a scriptable WebView for developers.
Stars: ✭ 16 (-68.63%)
Mutual labels:  headless
feed2email
RSS/Atom feed updates in your email
Stars: ✭ 37 (-27.45%)
Mutual labels:  headless

🤝 Better REST

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.

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].