PHP code example of lambda-twelve / one-record-drupal

1. Go to this page and download the library: Download lambda-twelve/one-record-drupal 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/ */

    

lambda-twelve / one-record-drupal example snippets


// The RS256 private key for tokens this server issues (one of the two).
$settings['one_record.signing_key_file'] = '/etc/one-record/signing-key.pem';
$settings['one_record.signing_key'] = "-----BEGIN PRIVATE KEY-----\n...";

// Client secrets for partners' token endpoints, keyed by our client id there.
$settings['one_record.partner_secrets']['our-client-id-at-partner'] = '...';

public static function getSubscribedEvents(): array {
  return [LogisticsObjectRevised::class => 'onRevised'];
}

$holder = \Drupal::service('one_record.data_holder');
$stored = $holder->create($logisticsObject);            // revision 1
$holder->update($changedObject);                        // records and applies a change
$holder->announce($stored->object->iri, $partnerAgent); // LOGISTICS_OBJECT_AVAILABLE
$holder->accept($actionRequestIri);