1. Go to this page and download the library: Download andrewcarteruk/node-red-api 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/ */
andrewcarteruk / node-red-api example snippets
use NodeRED\Instance;
use NodeRED\OAuth;
$instance = new Instance('http://localhost:1883');
$oAuth = new OAuth($instance);
$token = $oAuth->getToken('username', 'password');
// Tokens are serializable
$serializedToken = serialize($token);
$token = unserialize($serializedToken);
// Check if a token has expired
if ($token->hasExpired()) {
// ...
}