PHPackages                             moko-github/api-si-satellite - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. moko-github/api-si-satellite

ActiveLibrary[HTTP &amp; Networking](/categories/http)

moko-github/api-si-satellite
============================

Infrastructure générique pour satellites Laravel connectés à une API externe (client HTTP abstrait, middleware HMAC, commande d'installation).

v1.3.0(1mo ago)011[1 PRs](https://github.com/moko-github/api-si-satellite/pulls)MITPHPPHP ^8.2

Since May 19Pushed 1mo agoCompare

[ Source](https://github.com/moko-github/api-si-satellite)[ Packagist](https://packagist.org/packages/moko-github/api-si-satellite)[ RSS](/packages/moko-github-api-si-satellite/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (18)Versions (15)Used By (0)

moko-github/api-si-satellite
============================

[](#moko-githubapi-si-satellite)

Infrastructure générique pour satellites Laravel connectés à une API externe.

Fournit :

- **`SatelliteClient`** — classe abstraite HTTP avec `get()`, `post()`, `put()`, `delete()`, logging intégré et gestion d’erreurs typée
- **`VerifyWebhookSignature`** — middleware HMAC SHA-256 timing-safe pour les webhooks entrants
- **`SatelliteInstallCommand`** — commande `satellite:install` pour publier config, stubs et configurer le canal de log

---

Prérequis
---------

[](#prérequis)

- PHP 8.2+
- Laravel 11 ou 12

---

Installation
------------

[](#installation)

```
composer require moko-github/api-si-satellite
```

### Publier les fichiers

[](#publier-les-fichiers)

```
php artisan satellite:install
```

Ou manuellement :

```
php artisan vendor:publish --tag=satellite-config
php artisan vendor:publish --tag=satellite-stubs
```

### Variables d’environnement

[](#variables-denvironnement)

```
SATELLITE_API_URL=https://api.example.com
SATELLITE_API_TOKEN=ton-token
SATELLITE_API_TIMEOUT=10
SATELLITE_WEBHOOK_SECRET=un-secret-long-et-aléatoire
SATELLITE_LOG_LEVEL=debug
SATELLITE_LOG_CHANNEL=satellite
# Mettre à false uniquement si l’API utilise un certificat auto-signé (ex : qualification)
SATELLITE_VERIFY_SSL=true
```

VariableDéfautRôle`SATELLITE_API_URL`—URL de base de l’API distante`SATELLITE_API_TOKEN`—Token Bearer pour l’authentification`SATELLITE_API_TIMEOUT``10`Timeout HTTP en secondes`SATELLITE_WEBHOOK_SECRET`—Secret HMAC SHA-256 pour vérifier les webhooks (généré automatiquement par `satellite:install`)`SATELLITE_LOG_LEVEL``debug`Niveau de log du canal `satellite` dans `config/logging.php``SATELLITE_LOG_CHANNEL``satellite`Canal Laravel à utiliser pour les logs du client HTTP`SATELLITE_VERIFY_SSL``true`Vérification du certificat SSL. Mettre à `false` pour les environnements avec certificats auto-signés (ex : qualification)> `SATELLITE_LOG_LEVEL` contrôle **à quel niveau** on logue (debug, info, warning…). `SATELLITE_LOG_CHANNEL` contrôle **dans quel canal** on logue. Les deux sont complémentaires : le canal `satellite` est créé dans `config/logging.php` par `satellite:install`, avec `SATELLITE_LOG_LEVEL` comme niveau minimum.

### Dépannage : le canal de log `satellite` n’a pas été créé

[](#dépannage--le-canal-de-log-satellite-na-pas-été-créé)

`satellite:install` insère le canal `satellite` dans `config/logging.php` en l’ajoutant au tableau `'channels'`. Si votre fichier `config/logging.php` est fortement personnalisé (tableau `'channels'` absent, par exemple), la commande **ne modifie pas le fichier en silence** : elle affiche un avertissement et le snippet à coller manuellement.

La commande est **idempotente** : vous pouvez la relancer sans risque.

```
php artisan satellite:install
```

- Si le canal existe déjà : `Canal de log 'satellite' déjà présent…`
- Si le canal manque et peut être ajouté : il est inséré et vérifié après écriture.
- Si la commande ne peut pas l’ajouter (fichier atypique, droits d’écriture) : un **avertissement** s’affiche avec les instructions ci-dessous.

Pour l’ajouter manuellement, collez ce bloc dans le tableau `'channels'` de `config/logging.php` :

```
'satellite' => [
    'driver' => 'daily',
    'path'   => storage_path('logs/satellite.log'),
    'level'  => env('SATELLITE_LOG_LEVEL', 'debug'),
    'days'   => 14,
],
```

> Si vous préférez réutiliser un canal existant plutôt que d’en créer un, pointez simplement `SATELLITE_LOG_CHANNEL` vers ce canal (ex : `SATELLITE_LOG_CHANNEL=stack`).

Vérifiez ensuite que tout est en place avec `php artisan satellite:ping`(voir [Tester la connectivité](#tester-la-connectivit%C3%A9)).

---

Utilisation
-----------

[](#utilisation)

### 1. Créer un client HTTP spécifique

[](#1-créer-un-client-http-spécifique)

Étendre `SatelliteClient` dans le package privé de l’application :

```
use Moko\\Satellite\\Services\\SatelliteClient;

final class MyApiClient extends SatelliteClient
{
    public function __construct()
    {
        parent::__construct(
            baseUrl:    (string) config('my-api.url'),
            token:      (string) config('my-api.token'),
            timeout:    (int)    config('my-api.timeout', 10),
            logChannel: 'my-api',
            verifySSL:  (bool)   config('my-api.verify_ssl', true),
        );
    }

    public function getResource(int $id): MyResourceDTO
    {
        return MyResourceDTO::fromArray($this->get("/api/v1/resources/{$id}"));
    }
}
```

### 2. Protéger une route webhook

[](#2-protéger-une-route-webhook)

```
use Moko\\Satellite\\Http\\Middleware\\VerifyWebhookSignature;

// Clé par défaut : config('satellite.webhook_secret')
Route::post('/webhooks/my-api', MyWebhookController::class)
    ->middleware(VerifyWebhookSignature::class);

// Clé personnalisée (package privé avec sa propre config) :
Route::post('/webhooks/my-api', MyWebhookController::class)
    ->middleware(VerifyWebhookSignature::class.':my-api.webhook_secret');
```

Le middleware lit l’en-tête `X-Webhook-Signature` et la compare via `hash_equals` (temps constant).

### 3. Utiliser les stubs publiés

[](#3-utiliser-les-stubs-publiés)

Après `satellite:install`, deux stubs sont disponibles dans `stubs/satellite/` :

StubUsage`WebhookController.stub`Contrôleur de réception des webhooks`SyncJob.stub`Job de synchronisation cursor-based---

Gérer les erreurs
-----------------

[](#gérer-les-erreurs)

`SatelliteException` expose `statusCode`, `endpoint` et `errors` :

```
use Moko\\Satellite\\Services\\SatelliteException;

try {
    $data = $client->getResource(42);
} catch (SatelliteException $e) {
    Log::error('API error', [
        'status'   => $e->statusCode,
        'endpoint' => $e->endpoint,
        'errors'   => $e->errors,
    ]);
}
```

---

Tester la connectivité
----------------------

[](#tester-la-connectivité)

La commande `satellite:ping` vérifie que l'application peut joindre l'API distante.

```
# Endpoint par défaut (/health)
php artisan satellite:ping

# Endpoint personnalisé (ex : api-si)
php artisan satellite:ping --endpoint=/api/v1/health

# Surcharger l'URL (tester un environnement sans modifier .env)
php artisan satellite:ping --endpoint=/api/v1/health --url=https://api-qualification.example.com

# Appel sans token Bearer (endpoint vraiment public)
php artisan satellite:ping --endpoint=/api/v1/health --no-token
```

Exemple de sortie en succès :

```
Satellite Ping

  ● GET https://api.example.com/api/v1/health … 200 OK (42ms)

  {"status":"ok","version":"1.2.3"}

```

Exemple de sortie en erreur :

```
Satellite Ping

  ● GET https://api.example.com/api/v1/health … 500 (120ms)

```

---

Structure
---------

[](#structure)

```
src/
├── SatelliteServiceProvider.php
├── Console/Commands/
│   └── SatelliteInstallCommand.php
├── Http/Middleware/
│   └── VerifyWebhookSignature.php
└── Services/
    ├── SatelliteClient.php
    └── SatelliteException.php
config/
└── satellite.php
stubs/
├── SyncJob.stub
└── WebhookController.stub

```

---

Licence
-------

[](#licence)

MIT

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance91

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% 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 ~4 days

Total

6

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e86133cee7cb105f8a66c2594e77cc2cc96962f20a3e7c2be7c5f9d42b994bed?d=identicon)[moko-github](/maintainers/moko-github)

---

Top Contributors

[![moko-github](https://avatars.githubusercontent.com/u/62236867?v=4)](https://github.com/moko-github "moko-github (10 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (8 commits)")

---

Tags

laravelhttp clientwebhooksatellite

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/moko-github-api-si-satellite/health.svg)

```
[![Health](https://phpackages.com/badges/moko-github-api-si-satellite/health.svg)](https://phpackages.com/packages/moko-github-api-si-satellite)
```

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77922.3M186](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k96.5k1](/packages/mike-bronner-laravel-model-caching)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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