PHP code example of logipro / agora-learning-php

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

    

logipro / agora-learning-php example snippets



AgoraLearningPhp\AgoraLearningClient;
use AgoraLearningPhp\DTO\Input\Learner\LearnerInput;

$client = new AgoraLearningClient(
    'https://votre-instance.example.com', // TODO: à adapter
    'votre_cle_api'                       // TODO: à adapter
);

// Vérifier que l'API est joignable
$ping = $client->ping();
if ($ping->getStatusCode() !== 200) {
    throw new \RuntimeException(
        'Impossible de joindre l\'API Agora (HTTP ' . $ping->getStatusCode() . ')'
    );
}

// Créer un apprenant
$learner = $client->createLearner(new LearnerInput(
    'Dupont',
    'Marie',
    '[email protected]'
));

echo $learner->uuid;
bash
composer 
bash
cp examples/config.php.dist examples/config.php
# Éditer examples/config.php et renseigner l'URL et la clé API
bash
php examples/ping.php
php examples/person/get_collection.php
php examples/society/create.php
# etc.
bash
# Les deux images en une commande
docker compose build

# Une image spécifique
# PHP 7.4
docker compose build php

# PHP 8.5
docker compose build php85
bash
docker exec -ti agora-learning-php-php-1 /bin/bash
bash
# PHP 7.4
docker compose run --rm php composer install

# PHP 8.5
docker compose run --rm php85 composer install
bash
# PHP 7.4
docker compose run --rm php composer qa

# PHP 8.5
docker compose run --rm php85 composer qa
bash
# PHP 7.4
docker compose run --rm php composer test

# PHP 8.5
docker compose run --rm php85 composer test
bash
docker compose run --rm php composer phpstan
bash
# PHP 7.4
docker compose run --rm php composer infection

# PHP 8.5
docker compose run --rm php85 composer infection
bash
# Lancer les tests de mutation (4 threads)
composer infection

# Avec un seuil MSI minimal (ex : 80 %)
vendor/bin/infection --threads=4 --min-msi=80 --min-covered-msi=80

# Cibler un seul fichier source
vendor/bin/infection --threads=4 --filter=src/Service/Learner/Learner.php