- Can I use this bundle directly in Laravel, or do I need Symfony?
- While this is a Symfony bundle, you can integrate it into Laravel via the Symfony Bridge or extract its core logic (e.g., `FindPoints` and `RequestBuilder`) into a standalone Laravel package. The 4.2.1 config fix reduces service container risks, but Symfony dependencies like `HttpClient` may require manual replacement with Laravel’s `Http` facade.
- What Laravel versions and PHP versions does this bundle support?
- This bundle requires **PHP 8.4+** and is compatible with **Laravel 10+**. Ensure your project meets these requirements before installation. Symfony components (e.g., `HttpClient`) are bundled but can be swapped for Laravel equivalents if needed.
- How do I search for pickup points by location (e.g., city or postcode)?
- Use the `FindPointsRequestBuilder` to filter by location. For example, chain methods like `setCity('Warsaw')` or `setPostCode('00-001')` before calling `build()`, then pass the request to `FindPoints::findPoints()`. Supports single values or arrays for broader searches.
- Does this bundle support pagination for large result sets?
- Yes. Use `setPage(1)` and `setPerPage(20)` on the `FindPointsRequestBuilder` to control pagination. The bundle returns paginated responses from InPost’s API, which you can iterate or cache for performance.
- How are API errors handled? Can I customize error responses?
- The bundle surfaces InPost API errors as exceptions. For custom handling, extend the bundle’s exception classes or wrap API calls in a `try-catch` block. Log errors or return user-friendly messages via Laravel’s exception handler.
- Is there a way to cache pickup point searches to reduce API calls?
- Yes. Cache responses using Laravel’s cache system (e.g., Redis) by storing results of `FindPoints::findPoints()` with a key like `inpost_points_{$postcode}_{$timestamp}`. Implement a TTL (e.g., 1 hour) to ensure freshness.
- Can I use this bundle for shipment creation or label generation?
- No. This bundle is **read-only**—it only searches pickup points. For shipments/labels, use InPost’s direct API or a third-party Laravel package like `spatie/laravel-inpost` (if available) or build a custom service layer.
- What are the alternatives if I need write operations or a pure Laravel solution?
- For write operations, consider InPost’s raw API with Laravel’s `Http` client or a custom package. For a Laravel-native solution, extract the bundle’s logic (e.g., `FindPointsRequestBuilder`) into a new package using Laravel’s service container and `Http` facade.
- How do I test this bundle in my Laravel app? Should I mock the API?
- Test critical paths with Laravel’s HTTP tests or Pest. Mock the `FindPoints` command or use a test API key from InPost’s sandbox. Validate edge cases like invalid postcodes or rate limits. The 4.2.1 config fix should also be tested by simulating missing service configurations.
- Are there any known issues with multi-country support beyond Poland/Italy?
- The bundle primarily supports **Poland and Italy**. For other countries, extend the `FindPointsRequestBuilder` or modify the API request payload. Check InPost’s [API docs](https://docs.inpost24.com) for unsupported regions and adjust logic accordingly.