- Does php-http/cache-plugin work with Laravel’s HTTP client (Guzzle-based) without HTTPlug?
- No, this plugin requires an HTTPlug-compatible client. Laravel’s built-in HTTP client uses Guzzle directly, so you’d need to migrate to an HTTPlug wrapper like `php-http/guzzle7-adapter` first. Without HTTPlug, the plugin cannot intercept or cache responses.
- What Laravel versions are officially supported by this package?
- The package itself doesn’t specify Laravel support—it’s designed for PHP HTTP clients. However, since it relies on HTTPlug, ensure your Laravel app uses PHP 7.4+ (HTTPlug 2.x) or PHP 8.0+ (HTTPlug 3.x). Test compatibility manually if adopting this plugin.
- How do I configure cache storage (e.g., Redis vs. file) for this plugin?
- The plugin uses PSR-6 cache pools, so you’ll need to configure a compatible cache adapter (e.g., `php-http/cache-adapter-redis` or `php-http/cache-adapter-apcu`). No Laravel-specific helpers exist; you must manually set the cache pool in your HTTPlug client configuration.
- Can this plugin invalidate cached responses automatically based on HTTP headers?
- Yes, the plugin supports cache headers like `Cache-Control` and `ETag` for automatic validation. It respects `max-age`, `must-revalidate`, and `no-cache` directives, but edge cases (e.g., conditional requests) may require manual testing due to the unknown repository’s lack of documentation.
- Is there a way to test this plugin in a Laravel staging environment before production?
- Without repository access, you cannot verify the plugin’s behavior. Mock HTTPlug clients in PHPUnit using `php-http/message-factory` and a test cache pool (e.g., `array` adapter), but results may not reflect production behavior. Proceed with caution.
- What happens if the package’s repository is fake or abandoned? How do I verify legitimacy?
- Check for a GitHub/GitLab repository linked in the Composer package metadata. If none exists, the package is likely a scam or placeholder. Cross-reference the package name with known php-http projects (e.g., [php-http.org](https://php-http.org)) and avoid installation until legitimacy is confirmed.
- Does this plugin support shared cache invalidation across multiple Laravel app instances?
- Only if you configure a distributed PSR-6 cache (e.g., Redis, Memcached). File-based or APCu caches will not sync across instances. Ensure your cache adapter supports multi-process invalidation if needed.
- Are there alternatives to php-http/cache-plugin for Laravel that don’t require HTTPlug?
- Yes: Use Laravel’s built-in `Cache::remember()` with Guzzle, or packages like `spatie/laravel-cache-control` for HTTP cache headers. For PSR-6 caching, `stash/stash` or `cache/array-adapter` can work with Guzzle directly via middleware.
- How do I handle cache TTLs dynamically (e.g., per-request or per-route) in Laravel?
- Configure TTLs via the PSR-6 cache pool’s `getItem()` method or use middleware to set `Cache-Control` headers before requests. The plugin itself lacks Laravel-specific TTL helpers, so you’ll need custom logic in your HTTPlug client setup.
- What are the risks of using this package in production if the repository is unverified?
- Critical risks include: undocumented bugs, security vulnerabilities, lack of updates, and potential license violations. Without a maintainer or issue tracker, you cannot resolve problems or receive patches. Avoid production use until the repository is confirmed legitimate and actively maintained.