PHP code example of milpa / governance

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

    

milpa / governance example snippets


use Milpa\Governance\GovernanceCompiler;
use Milpa\Governance\GovernanceValidator;

// $repository implements GovernanceRepositoryInterface — the host already loaded
// .milpa/governance/ (ADRs + profile.json) and handed the engine objects, not files.
$decisions = $repository->decisions();   // array<GovernanceDecision>
$profile = $repository->profile();       // GovernanceProfile

$validator = new GovernanceValidator(GovernanceValidator::DEFAULT_BOUND_TO);
$validator->validate($decisions, $profile); // throws GovernanceException if the profile lies

$plan = (new GovernanceCompiler($validator))->compile($decisions, $profile);

$plan->profileName;    // the profile's name
$plan->gates;          // array<GovernanceGate> — this contract's honest gates
$plan->toArray();      // deterministic, serializable shape