- Does this package support real-time shipping rate calculations for FedEx, UPS, and USPS in Laravel?
- Yes, the package abstracts carrier APIs into a unified interface, allowing real-time rate calculations for supported providers like FedEx, UPS, and USPS. It handles API requests asynchronously via Laravel’s queues to avoid checkout delays. You’ll need to configure API keys in the `config/shipping.php` file for each carrier.
- How do I add a custom shipping method or carrier (e.g., DHL or Australia Post) to this package?
- You can extend the package by implementing the `ProviderInterface` and registering your new carrier via the `ShippingManager::extend()` method in a service provider. The package’s modular design makes it easy to add new providers without modifying core logic. Documentation for the interface is typically included in the `src/Contracts` directory.
- Will this package work with Laravel 10+ and the latest Shopper framework version?
- The package is designed to work with modern Laravel versions (9.x and 10.x) and aligns with the Shopper ecosystem. Always check the package’s `composer.json` for Laravel version requirements and the Shopper framework compatibility. If using Shopper, ensure your core framework version matches the package’s dependencies.
- Can I use this package for international shipping, including customs forms or duty calculations?
- The package supports international shipping by design, but customs forms and duty calculations depend on the carrier’s API capabilities. Some providers (like FedEx or DHL) offer these features, while others may require manual handling. You can extend the package to include custom logic for unsupported carriers via the `ProviderInterface`.
- How do I handle rate limits or API throttling when calling carrier APIs during peak checkout times?
- The package recommends using Laravel’s caching (e.g., Redis) to store rate calculations temporarily and implement exponential backoff for retries. You can also configure rate-limiting logic in your custom provider implementations. For high-volume stores, consider using a queue worker to process API calls asynchronously.
- Does this package include built-in support for printing shipping labels (e.g., FedEx, UPS) in Laravel?
- Yes, the package supports label generation for compatible carriers like FedEx and UPS. Labels can be generated synchronously or asynchronously via Laravel queues. The generated labels are typically returned as PDFs or downloadable files, which you can integrate into your order fulfillment workflows.
- How do I configure shipping zones and rules (e.g., free shipping over $50 for US states) in this package?
- Shipping zones and rules are configured via Laravel’s configuration files (`config/shipping.php`) and optionally stored in the database using Eloquent models. You can define zones (e.g., country, state, or postal code ranges) and attach conditions like minimum order values. The package emits events (e.g., `ShippingRateCalculated`) to allow further customization.
- Is there a way to test this package locally without hitting real carrier APIs (e.g., for unit/integration tests)?
- Yes, you can mock carrier API responses using tools like VCR (VCR for PHP) or Mockery to stub HTTP requests. The package’s provider interface is designed for testability, allowing you to inject fake implementations during testing. Example test setups are often included in the package’s documentation or tests directory.
- Can I integrate this package with Laravel’s API resources to return structured shipping rate responses?
- Absolutely. The package is designed to work seamlessly with Laravel’s API Resources. You can format shipping rate responses using `ShippingRateResource` or similar classes to ensure consistent JSON output. This is especially useful for headless e-commerce applications or mobile apps consuming your API.
- What are some alternatives to this package if I need a simpler or more lightweight shipping solution for Laravel?
- If you’re looking for alternatives, consider packages like `spatie/laravel-shipping` for basic carrier integrations or `laravel-ecommerce/shipping` for more modular solutions. For Shopper-specific needs, this package is optimized for the ecosystem, but you could also evaluate standalone packages like `webklex/laravel-shop` for broader e-commerce features. Choose based on your need for carrier support, extensibility, and Laravel integration depth.