PHP code example of anode-club / sdk-php

1. Go to this page and download the library: Download anode-club/sdk-php 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/ */

    

anode-club / sdk-php example snippets




nodeClub\MetadonneesMandatAccesDonneesPDL\V1\Handler\Pdf;

// Instancier le gestionnaire PDF
$pdfHandler = new Pdf('mandat.pdf');

// Extraire les métadonnées du mandat
$mandat = $pdfHandler->getMandat();

// Afficher les données
var_dump($mandat);



nodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Parties;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Parties\Partie\PersonneMorale;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Parties\Partie\PersonneMorale\RepresentantLegal;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Parties\Partie\PersonnePhysique;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Objet;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Objet\Delegations;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Objet\Donnees;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Objet\PointsDeLivraison;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Objet\PointsDeLivraison\Prm;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Objet\PointsDeLivraison\Pce;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Dto\Mandat\Consentement;
use AnodeClub\MetadonneesMandatAccesDonneesPDL\V1\Handler\Pdf;

// Créer les parties du mandat
$mandant = new PersonneMorale(
    'ACME',
    '123456789', 
    '1 rue de la République, 69001 Lyon',
    new RepresentantLegal('MARTIN', 'Julien', 'Président', '[email protected]', '+33123456789')
);

$mandataire = new PersonnePhysique(
    'DUPONT',
    'Jean',
    '456 avenue des Fournisseurs, 75001 Paris',
    '[email protected]',
    '+33987654321'
);

$parties = new Parties($mandant, $mandataire);

// Définir l'objet du mandat
$donnees = new Donnees(
    true,  // Données techniques
    true,  // Données contractuelles  
    false, // Données d'usage
    24     // Période d'historique en mois
);

$pointsDeLivraison = (new PointsDeLivraison())
    ->add(new Prm('12345678901234'))  // PDL électricité
    ->add(new Pce('GI123456'));       // PDL gaz naturel

$delegations = (new Delegations())
    ->add('Consultation des données de consommation')
    ->add('Transmission aux fournisseurs d\'énergie');

$objet = new Objet($donnees, $pointsDeLivraison, $delegations);

// Définir le consentement
$consentement = new Consentement(
    new \DateTimeImmutable('2024-01-01 12:34:56', new \DateTimeZone('Europe/Paris')),
    new \DateTimeImmutable('2024-12-31 23:59:59', new \DateTimeZone('Europe/Paris'))
);

// Créer le mandat complet
$mandat = new Mandat($parties, $objet, $consentement);

// Intégrer dans le PDF
$pdfHandler = new Pdf('mandat.pdf');
$pdfHandler->setMandat($mandat);
bash
composer