dinas/shipping-sdk-laravel
Laravel SDK for the Dinas Shipping API. Send requests to REST endpoints and receive/verify incoming webhooks. Webhook events are logged and dispatched as Laravel jobs for async updates like shipment status changes and document availability.
Shipping::getCars(), Shipping::syncCars()), reducing boilerplate for API interactions.Car, Voyage, Document, and AlbumType encapsulate business logic, reducing API endpoint management overhead.onResolve callbacks, enabling workflows like:
Shipping::cars(), Shipping::carPhotos(), etc., for custom use cases.| Risk Area | Assessment | Mitigation |
|---|---|---|
| Package Maturity | Low stars (0), recent release (2026), but MIT license and active CI/CD suggest stability. | Evaluate via test coverage and documentation completeness. |
| Webhook Reliability | Depends on Spatie’s WebhookClient, which is robust but requires proper queue setup (e.g., ShouldQueue jobs). |
Test webhook idempotency and failure recovery (e.g., retries, dead-letter queues). |
| Async Job Management | Callback storage in webhook_jobs table may bloat over time. |
Configure delete_after_days and schedule model:prune (as documented). Monitor table growth. |
| API Versioning | No explicit versioning in SDK; assumes Dinas API stability. | Monitor Dinas API deprecations and update SDK accordingly. |
| Performance | Async operations (e.g., photo/document uploads) may throttle if not chunked properly. | Use Shipping::storeCarPhotos() with default chunking (50 items); adjust via config if needed. |
| Broadcasting Dependency | Pusher broadcasting is opt-in but adds real-time complexity. | Disable if not needed (DINAS_SHIPPING_BROADCASTING=false). |
webhook_jobs table for pruning?DINAS_SHIPPING_SECRET) rotated periodically?env)?| Component | Fit Level | Notes |
|---|---|---|
| Laravel Backend | ✅ Excellent | Native integration with facades, queues, and events. |
| PHP 8.1+ | ✅ Excellent | SDK uses modern PHP features (e.g., named arguments, enums). |
| MySQL/PostgreSQL | ✅ Excellent | Uses Eloquent models for webhook jobs and migrations. |
| Redis | ✅ Good | Required for queue workers (e.g., laravel-queue:work) and broadcasting (if enabled). |
| Pusher/Alternative | ⚠️ Optional | Only needed for real-time broadcasts; can be disabled. |
| Docker/Kubernetes | ✅ Good | Containerized deployments should handle queue workers and webhook endpoints separately. |
| Monolithic vs. Microservices | ✅ Flexible | Works in both; facade pattern simplifies API calls. |
Phase 1: API Integration (Low Risk)
composer require dinas/shipping-sdk-laravel..env (DINAS_SHIPPING_TOKEN, DINAS_SHIPPING_SECRET).php artisan vendor:publish --tag=shipping-sdk-laravel-migrations --tag=shipping-sdk-laravel-config.php artisan migrate.Shipping::getCars(), Shipping::syncCars()).Phase 2: Webhook Setup (Medium Risk)
Route::dinasShippingWebhooks('dinas-shipping/webhook').php artisan webhook:dinas-shipping -i.Phase 3: Async Workflows (High Value)
onResolve callbacks for critical operations (e.g., document uploads).laravel-queue:work) to process webhooks asynchronously.Phase 4: Monitoring & Optimization
model:prune for WebhookJob cleanup.| Step | Dependency | Order | Notes |
|---|---|---|---|
| Install SDK | None | 1 | composer require dinas/shipping-sdk-laravel. |
Configure .env |
SDK installed | 2 | Set DINAS_SHIPPING_TOKEN and DINAS_SHIPPING_SECRET. |
| Publish migrations/config | SDK installed | 3 | php artisan vendor:publish --tag=shipping-sdk-laravel-*. |
| Run migrations | Config published | 4 | php artisan migrate. |
| Set up webhook route | Migrations complete | 5 | Add to routes/api.php or routes/web.php. |
| Exclude webhook from CSRF | Webhook route added | 6 | Update app/Providers/AppServiceProvider.php. |
| Register webhook with Dinas | Webhook route configured | 7 | php artisan webhook:dinas-shipping -i. |
| Test API endpoints | Webhook registered | 8 | Verify Shipping::getCars(), Shipping::syncCars(), etc. |
| Implement queue workers | API tests passed | 9 | laravel-queue:work for processing webhooks. |
| Set up async callbacks | Queue workers running | 10 |
How can I help you explore Laravel packages today?