{"id":23491225,"url":"https://github.com/robinscholz/better-rest","last_synced_at":"2025-04-15T06:38:30.691Z","repository":{"id":37548860,"uuid":"195016271","full_name":"robinscholz/better-rest","owner":"robinscholz","description":"Kirby plugin for better REST requests","archived":false,"fork":false,"pushed_at":"2023-04-19T20:08:29.000Z","size":4610,"stargazers_count":51,"open_issues_count":8,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T17:11:13.093Z","etag":null,"topics":["api","cms","headless","json","kirby","kirbycms","kirbytag","kirbytags","markdown","rest","srcset"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robinscholz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-03T08:53:56.000Z","updated_at":"2024-09-12T18:02:14.000Z","dependencies_parsed_at":"2022-09-10T09:11:10.168Z","dependency_job_id":null,"html_url":"https://github.com/robinscholz/better-rest","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinscholz%2Fbetter-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinscholz%2Fbetter-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinscholz%2Fbetter-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinscholz%2Fbetter-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinscholz","download_url":"https://codeload.github.com/robinscholz/better-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023611,"owners_count":21199957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cms","headless","json","kirby","kirbycms","kirbytag","kirbytags","markdown","rest","srcset"],"created_at":"2024-12-25T01:18:27.494Z","updated_at":"2025-04-15T06:38:30.674Z","avatar_url":"https://github.com/robinscholz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤝 Better REST\n\n![Release](https://flat.badgen.net/packagist/v/robinscholz/better-rest?color=f28d1a)\n![Stars](https://flat.badgen.net/packagist/ghs/robinscholz/better-rest?color=gray)\n![Downloads](https://flat.badgen.net/packagist/dt/robinscholz/better-rest?color=gray)\n![Issues](https://flat.badgen.net/packagist/ghi/robinscholz/better-rest?color=yellow)\n[![Build Status](https://flat.badgen.net/travis/robinscholz/better-rest)](https://travis-ci.com/robinscholz/better-rest)\n[![Coverage Status](https://flat.badgen.net/coveralls/c/github/robinscholz/better-rest)](https://coveralls.io/github/robinscholz/better-rest) \n[![Twitter](https://flat.badgen.net/badge/twitter/RobinScholz)](https://twitter.com/RobinScholz)\n[![Twitter](https://flat.badgen.net/badge/twitter/bnomei)](https://twitter.com/bnomei)\n\nA [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.\n\n## Disclaimer\n\nWhile 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).\n\n## Usage\n\nThe API can be accessed at `/rest`. The plugin only allows `GET` requests.\n\n### Authentification\nRequests 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).\n\n_Basic Auth_ needs to be enabled in the `site/config/config.php`:\n\n```\nreturn [\n    'api' =\u003e [\n        'basicAuth' =\u003e true\n    ]\n];\n```\n\n### Kirby 3 API\n\nExamples:\n\n- `rest/pages/:id` : https://getkirby.com/docs/reference/api/pages\n- `rest/site` : https://getkirby.com/docs/reference/api/site\n- `rest/users/:id` : https://getkirby.com/docs/reference/api/users\n\n\u003e [Official Kirby 3 API docs](https://getkirby.com/docs/reference/api/)\n\n### Better-Rest Settings from Query\n\nAll 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.\n\nExamples:\n\n- `rest/pages/test?br-srcset=375,1200` : **br-srcset**\n- `rest/pages/test?br-smartypants=1` : **br-smartypants**\n- `rest/pages/test?br-language=fr` : **br-language**\n- `rest/pages/test?br-kirbytags=0\u0026br-srcset=0` : **br-kirbytag br-srcset**\n\n### Multilang\nThe 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.\n\n## Settings\n\n### Config File\n\n- The plugin converts _kirbytags_ to HTML and adds a `srcset` to images by default.\n- Additionally it is possible to enable [smartypants](https://michelf.ca/projects/php-smartypants/).\n- To overwrite the default language it is possible to set a language code.\n\nAll settings need to be prefixed with `robinscholz.better-rest.`!\n\n| Settings    | Default                  | Options            |\n| ----------- | ------------------------ | ------------------ |\n| kirbytags   | `true`                   | `boolean`          |\n| smartypants | `false`                  | `boolean`          |\n| srcset      | `[375, 667, 1024, 1680]` | `Array` or `false` |\n| language    | `null`                   | `null` or `string` |\n\n## Caveats\n\n### HTTPS\nThe Kirby installation needs to be served with a _TLS Certicificate_ via `https`.\n\n### Local setup\nFor local development use [Laravel Valet](https://laravel.com/docs/master/valet) or disable `https` in the `site/config/config.php`:\n\n``` php\nreturn [\n  'api' =\u003e [\n    'basicAuth' =\u003e true,\n    'allowInsecure' =\u003e true\n  ]\n];\n```\n\u003e **WARNING**: Do not use this setting for production environments!\n\n## Installation\n\n### Download\nDownload and copy this repository to `/site/plugins/better-rest`.\n\n### Composer \n```\ncomposer require robinscholz/better-rest\n```\n\n### Git submodule\n```\ngit submodule add https://github.com/robinscholz/better-rest.git site/plugins/better-rest\n```\n\n## Credits\nA 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)!\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinscholz%2Fbetter-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinscholz%2Fbetter-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinscholz%2Fbetter-rest/lists"}