PHP code example of robertgarrigos / backdrop-headless-client

1. Go to this page and download the library: Download robertgarrigos/backdrop-headless-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robertgarrigos / backdrop-headless-client example snippets


/* 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);