robertgarrigos/backdrop-headless-client

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

2.0.0-beta.4 2020-04-27 10:13 UTC

This package is auto-updated.

Last update: 2024-11-09 07:59:51 UTC


README

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.

Compatibility

v. 1.* of this package is compatible with Laravel 5.8

v. 2.* of this package is compatible with Laravel 7.*

Installation

You can install the package via composer:

composer require robertgarrigos/backdrop-headless-client

Optionally, you can use artisan vendor:publish --tag=backdrop-config 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}/{contextual_arguments}{filter_arguments} */

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

/* Paragraphs (v3): /api/v3/paragraphs/{id} */

$paragraph = Backdrop::getParagraph($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.