robertgarrigos/backdrop-headless-client

Laravel 5 REST API client for a backdrop cms site with the headless module.

1.0.1 2019-08-06 15:28 UTC

README

This package is still in a heavy development process

Latest Version on Packagist Build Status Scrutinizer Code Quality Total Downloads

This is a laravel package which allows you to pull data from a backdrop cms site, configured with the headles module. Thus you can use the backdrop site as a backend and laravel as front end.

Installation

You can install the package via composer:

composer require robertgarrigos/backdrop-headless-client

Optionally, you can use artisan vendor publish to publish a config file.

You need to add a config value in your .env file for the backdrop api url as:

BACKDROP_API_SERVER="https://example.com"

Usage

To make use of this package, you need to install and config a backdrop cms site with the headless module, which is reponsible to create the JSON end points.

You acces those endpoints in your controller with:

/* Nodes (v2): /api/v2/node/{type}/{id} */

$node = Backdrop::getNode($type, $id);

/* Terms: /api/{vocabulary}/term/{id} */

$term = Backdrop::getTerm($vocabulary, $id);

/* Views (v2): /api/v2/views/{view_name}/{display_id}{arguments} */

$view = Backdrop::getView($view, $display_id, $args);

/* Paragraphs (v2): /api/v2/paragraphs/{type}/{id} */

$paragraph = Backdrop::getParagraph($type, $id);

Read my blog post about this package for a deeper understanding of how it works and how to use it.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email robert@garrigos.cat instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.