answear/speedy-pickup-point-bundle
FindOffice, GetAllPostcodesRequest), which aligns well with Laravel’s console commands or service-layer abstractions.symfony/http-kernel to instantiate the bundle in a Laravel service.username, password, privateKey), which may need environment variable abstraction for security.| Risk Area | Assessment |
|---|---|
| Symfony-Laravel Gap | High (requires abstraction layer). |
| API Stability | Medium (Speedy.bg API changes may break the bundle; monitor api.speedy.bg). |
| Error Handling | Low (Guzzle timeouts and Symfony’s error handling are robust). |
| Testing | Medium (limited test coverage; rely on Speedy.bg API mocking). |
| Performance | Low (Guzzle 7 is optimized; caching responses may be needed for high volume). |
config/services.php?HttpKernel.
AnswearSpeedyBundle in config/app.php (if using Lumen) or create a custom service container.// app/Providers/AppServiceProvider.php
public function register()
{
$kernel = new \Symfony\Component\HttpKernel\HttpKernel(
new \Answear\SpeedyBundle\AnswearSpeedyBundle(),
'dev',
true
);
$this->app->singleton('speedy.client', fn() => $kernel);
}
SpeedyClient) that uses Guzzle directly.guzzlehttp/guzzle (v7+), symfony/serializer, and webmozart/assert, so no additional composer installs are needed beyond the bundle.FindOffice and GetAllPostcodesRequest work with mock credentials.// app/Services/SpeedyService.php
class SpeedyService {
public function findOffice(string $postcode): array
{
$command = new \Answear\SpeedyBundle\Command\FindOffice();
return $command->findOffice(new \Answear\SpeedyBundle\Request\FindOfficeRequest($postcode));
}
}
answear_speedy config to Laravel’s .env:
SPEEDY_USERNAME=your_username
SPEEDY_PASSWORD=your_password
SPEEDY_PRIVATE_KEY=your_key
SPEEDY_LANGUAGE=BG
SPEEDY_CLIENT_SYSTEM_ID=12345
config/speedy.php:
'speedy' => [
'username' => env('SPEEDY_USERNAME'),
'password' => env('SPEEDY_PASSWORD'),
// ...
],
composer require answear/speedy-pickup-point-bundle
config/bundles.php (Symfony) or wrap in Laravel service..env variables.php artisan tinker to test SpeedyService::findOffice().api.speedy.bg).\Log::debug('Speedy API Response', ['data' => $response]);
HandleExceptions middleware for user-friendly messages.try {
$response = $speedyService->findOffice($postcode);
} catch (\GuzzleHttp\Exception\RequestException $e) {
\Log::error('Speedy API failed', ['error' => $e->getMessage()]);
throw new \Exception('Unable to fetch pickup points. Try again later.');
}
$response = Cache::remember("speedy_offices_{$postcode}", now()->addHours(1), fn() =>
$speedyService->findOffice($postcode)
);
| Failure Scenario | Mitigation Strategy |
|---|---|
| Speedy.bg API downtime | Implement fallback logic (e.g., cached data or user notification). |
| Invalid credentials | Validate config on app boot; use Laravel’s BootstrapServiceProvider. |
| Rate limiting by Speedy.bg | Add retry logic with jitter (e.g., spatie/laravel-queueable-middleware). |
| Symfony-Laravel integration bug | Isolate bundle in a separate service to limit blast radius. |
How can I help you explore Laravel packages today?