PHP code example of cadasto / openehr-bmm

1. Go to this page and download the library: Download cadasto/openehr-bmm 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/ */

    

cadasto / openehr-bmm example snippets


use Cadasto\OpenEHR\BMM\Model\BmmSchema;

// Load a BMM schema from a JSON file
$json = json_decode(file_get_contents('openehr_rm_1.2.0.bmm.json'), true);
$schema = BmmSchema::fromArray($json);

// Access schema metadata
echo $schema->getSchemaId(); // "openehr_rm_1.2.0"

// Navigate packages and classes
foreach ($schema->packages as $package) {
    echo $package->name . PHP_EOL;
}

// Serialize back to JSON
echo json_encode($schema, JSON_PRETTY_PRINT);