cleverage/colissimo-bundle
CleverAge ColissimoBundle provides Symfony services to access and consume Colissimo web services, including shipping, pickup points, and tracking. Requires PHP 7.4+ and Symfony 4, 5, or 6; install via Composer and configure your contract credentials.
spatie/laravel-symfony). Native Laravel integration would require abstraction layers (e.g., facades, service containers) to map Symfony services to Laravel’s DI.PickupPointsService, TrackingService) can be extracted into standalone PHP classes, wrapped in Laravel’s Illuminate\Support\Facades or a custom service provider for loose coupling. v1.1.3 reinforces this: TrackingService::call now accepts API-key authentication, so the tracking path can be wrapped independently of the contract-number/password credential model.HttpClient. Minimal boilerplate needed for API calls..env can replace Symfony’s YAML config (e.g., CLEVERAGE_COLISSIMO_CONTRACT_NUMBER). Example:
// config/services.php
'colissimo' => [
'contract_number' => env('COLISSIMO_CONTRACT_NUMBER'),
'password' => env('COLISSIMO_PASSWORD'),
'api_key' => env('COLISSIMO_API_KEY'), // v1.1.3: tracking auth
],
symfony/dependency-injection as a standalone library.@Route).WebTestCase) won’t integrate natively. Use Laravel’s Http or Mockery for unit tests. Add coverage for both auth modes on TrackingService::call.laravel-queue) may need adaptation.Illuminate\Support\Facades\Retry or spatie/laravel-queue-retries could integrate.CountryCode enum or add validation.spatie/laravel-symfony to embed the bundle in a Symfony microkernel within Laravel (e.g., for complex routing or forms).App\Services\ColissimoService with Guzzle HTTP calls. Example:
class ColissimoService {
public function __construct(private Client $httpClient) {}
public function getPickupPoints(string $zipCode) {
return $this->httpClient->post('https://api.colissimo.fr/...', [
'json' => ['zipCode' => $zipCode],
'auth' => [env('COLISSIMO_CONTRACT_NUMBER'), env('COLISSIMO_PASSWORD')],
]);
}
public function track(string $parcelNumber) {
// v1.1.3: API-key path, no contract credentials required
return $this->httpClient->get("https://api.colissimo.fr/tracking/{$parcelNumber}", [
'headers' => ['X-Api-Key' => env('COLISSIMO_API_KEY')],
]);
}
}
Colissimo::pickupPoints()) for cleaner syntax.spatie/laravel-symfony)..env, including the new apiKey option.spatie/laravel-queue-retries).Route::post('/colissimo/pickup', [ColissimoController::class, 'pickupPoints'])).ColissimoWebhookHandler listening to colissimo.tracking queue).symfony/http-client, symfony/options-resolver, etc. These can be installed as standalone packages in Laravel:
composer require symfony/http-client symfony/options-resolver
TrackingService::call option. This removes the previous need to hand-roll an OAuth/API-key extension and reduces the privilege level required by tracking-only workloads.symfony/http-client’s auth stack if Colissimo moves that direction..env (contract number, password, and now API key for tracking).PickupPointsService first (simplest API, contract auth).ShippingService (more complex payloads, contract auth).TrackingService — now the cheapest to wire up thanks to v1.1.3’s API-key support; a good candidate for an early read-only slice to de-risk the integration.Illuminate\Support\Facades\Cache) for pickup points to reduce API calls.cleverage/colissimo-bundle and Symfony components for breaking changes. v1.1.3 is a non-breaking additive patch (single PR, single contribution), so upgrade is low-risk — but pin to ^1.1.3 to lock in the API-key capability. Laravel’s slower release cycle may require backporting fixes..env to avoid YAML sprawl. Use Laravel’s config() helper to override defaults:
'colissimo' => [
'test_mode' => env('COLISSIMO_TEST_MODE', false),
'auth' => [
'contract_number' => env('COLISSIMO_CONTRACT_NUMBER'),
'password' => env('COLISSIMO_PASSWORD'),
],
'tracking' => [
'api_key' => env('COLISSIMO_API_KEY'),
],
],
dd() or Log::debug() to inspect Colissimo API responses. The bundle’s test mode (testModeEnabled: true) helps simulate API calls. With two auth paths, log which auth mode was used per tracking call to shorten incident triage.getPickupPoints()) over internal classes.laravel-queue).redis for pickup points).| Failure Scenario | Mitigation Strategy |
|---|---|
| Colissimo API downtime | Implement retry logic with exponential backoff (e.g., spatie/laravel-retryable). |
| Authentication failures | Validate credentials on startup (e.g., boot() method in a service provider); check contract and API key separately. |
| Invalid/rotated tracking API key (v1.1.3) | Distinct exception/log channel for tracking auth; rotate via .env/secret store without redeploying shipping config; fall back to contract auth if enabled. |
| Rate limit exceeded | Cache responses aggressively; use queue delays. |
| API schema changes | Version pinning in composer.json; feature flags for new endpoints. |
| Symfony-specific errors | Isolate bundle usage behind try-catch blocks; log errors to Sentry/Laravel logs. |
README.md in your repo covering install, .env keys (including the new COLISSIMO_API_KEY), test-mode usage, and which services require which credential. Document why tracking uses API key vs. contract auth so future maintainers don’t collapse the two.How can I help you explore Laravel packages today?