PHPackages                             ludicat/api-gar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ludicat/api-gar

ActiveLibrary[API Development](/categories/api)

ludicat/api-gar
===============

A PSR-18 API wrapper for GAR french administration API

v1.1.1(5mo ago)025MITPHPPHP &gt;=7.3

Since Oct 10Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/Ludicat/api-gar)[ Packagist](https://packagist.org/packages/ludicat/api-gar)[ RSS](/packages/ludicat-api-gar/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

GAR API SDK
===========

[](#gar-api-sdk)

GAR is a French government SSO mostly used for colleges and high schools. This SDK provide an abstraction layer for PHP integration.

Current GAR version supported : 6.1 - June 2022

Install
=======

[](#install)

Run

```
composer req ludicat/api-gar

```

You'll need a PSR-18 http api package, there is an embedded GuzzleAdapter. If you want to create yours, just extends Ludicat\\ApiGar\\Adapter\\AbstractAbonnementWs

```
composer req php-http/guzzle7-adapter

```

Quick start
===========

[](#quick-start)

We assume you already applied to the GAR service and for a certified pem key. (remember to provide them with your app "notice")

First, create a client :

```
$serviceProvider = new \Ludicat\ApiGar\Model\ServiceProvider(
    '123456789', // Your company siret
    \Ludicat\ApiGar\Model\ServiceProvider::ISNI_NONE, // ISNI number or none constant
    'ark:/12345/myRessource' // Your resource ID
);
// Could be another adapter
$adapter = new \Ludicat\ApiGar\Adapter\GuzzleAdapter(
    __DIR__.'/config/cert/app.pem', // Pem key (certified by government)
    __DIR__.'/config/cert/app.key', // Private key
    __DIR__.'/config/cert/harica.crt', // Harica cert
    'Accordeon' // Private key pass,
    Ludicat\ApiGar\Adapter\AbonnementWsInterface::ENDPOINT_DEV // Default one
    // Ludicat\ApiGar\Adapter\AbonnementWsInterface::ENDPOINT_PROD // Once you're ready for production, please use this constant instead.
);
$client = new \Ludicat\ApiGar\Client($adapter, $serviceProvider);

```

Then you can call for any method :

```
// Create / retrieve the Abonnement object, you can pass the $serviceProvider for default values preset (recommanded)
$abonnement = new \Ludicat\ApiGar\Model\Abonnement($serviceProvider);
$abonnement
    ->setCommentaireAbonnement('Ceci est un test')
    ->setDebutValidite((new \DateTime())->format('Y-m-d\T00:00:00'))
    ->setAnneeFinValidite(date('Y')  . '-' . (date('Y')+1))
    ->addUaiEtab('0560010G')
    ->setLibelleRessource('Centre de ressources pedagogiques en francais')
    ->setTypeAffectation(\Ludicat\ApiGar\Model\Abonnement::TYPE_INDIV)
    ->setCategorieAffectation(\Ludicat\ApiGar\Model\Abonnement::CATEGORY_TRANSFERABLE)
    ->setNbLicenceGlobale(\Ludicat\ApiGar\Model\Abonnement::UNLIMITED_LICENCE)
    ->setCodeProjetRessource('CODEPRJ001')
;

// Optional, you can validate the object here for easier data control
$validator = new \Ludicat\ApiGar\Validator\AbonnementValidator();
$validatorResponse = $validator->validate($abonnement);
if (!$validatorResponse->isValid()) {
    foreach ($validatorResponse->getViolations() as $violation) {
    printf('%s: %s', $violation->getProperty(), $violation->getMessage());
    echo PHP_EOL;
}

// Send request
$response = $client->create($abonnement);
// $response = $client->update($abonnement);
// $response = $client->delete($abonnement);

// Please note they use 201 (as it should be) for OK create response, not 200
if (201 === $response->getStatusCode()) {
    // Logic
}
// Don't forget to save your idAbonnement somewhere if you used the default generated one

```

Fetch all Abonnement
====================

[](#fetch-all-abonnement)

```
// Create client
// Then just call this method
$result = $client->getAbonnements();

```

You can filter on specific criteria (as explained in GAR documentation)

```
$abonnementFilter = new \Ludicat\ApiGar\Model\AbonnementFilter();
$abonnementFilter
    ->setTri(\Ludicat\ApiGar\Model\AbonnementFilter::TRI_DSC) // Default sort column to id abonnement
    ->addFiltre((new \Ludicat\ApiGar\Model\Filtre(
        \Ludicat\ApiGar\Model\Filtre::FILTRE_PUBLIC_CIBLE,
        \Ludicat\ApiGar\Model\Abonnement::PUBLIC_CIBLE_ELEVE
    )))
    ->addFiltre((new \Ludicat\ApiGar\Model\Filtre(
        \Ludicat\ApiGar\Model\Filtre::FILTRE_CATEGORY_AFFECTATION,
        \Ludicat\ApiGar\Model\Abonnement::CATEGORY_TRANSFERABLE
    )))
;

// A list of Abonnement objects
$result = $client->getAbonnements($abonnementFilter);

```

Fetch all Etablissement
=======================

[](#fetch-all-etablissement)

```
// A list of Etablissement objects
$result = $client->getEtablissements();

```

Run tests
=========

[](#run-tests)

```
make tests

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance72

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~193 days

Recently: every ~289 days

Total

7

Last Release

158d ago

Major Versions

v0.1.3 → v1.0.02022-10-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/19ed41f54971ca2c9a6d2cd25178b46b7d38164bc8a16b046dc0556c5871d991?d=identicon)[Jihel](/maintainers/Jihel)

---

Top Contributors

[![Jihell](https://avatars.githubusercontent.com/u/3269035?v=4)](https://github.com/Jihell "Jihell (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ludicat-api-gar/health.svg)

```
[![Health](https://phpackages.com/badges/ludicat-api-gar/health.svg)](https://phpackages.com/packages/ludicat-api-gar)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
