- What Laravel versions does `mcustiel/phiremock-common` support, and why?
- This package requires **Laravel 10+** due to its **PHP 8.2+ dependency**. Laravel 9.x (PHP 8.1) is incompatible because PHP 8.2 introduced breaking changes like named arguments and stricter type systems. If you’re on Laravel 9, you’ll need to upgrade or seek alternatives like Laravel’s built-in `Http::fake()` or Mockery.
- How do I install `phiremock-common` in a Laravel project?
- Run `composer require mcustiel/phiremock-common` in your project root. Ensure your `composer.json` meets PHP 8.2+ and Laravel 10+ requirements. The package provides no standalone CLI—it’s a dependency for **Phiremock Server/Client**, so install those separately if needed (e.g., `mcustiel/phiremock-server`).
- Can I use this package without Phiremock Server/Client?
- No, `phiremock-common` is **utility-only**—it lacks standalone functionality. It’s designed for internal use by Phiremock’s ecosystem. If you’re not using Phiremock’s HTTP mocking tools, this package offers no direct value. Consider Laravel’s `Http::fake()` or Pest’s HTTP plugins instead.
- Does this package work with Laravel’s HTTP testing helpers like `Http::fake()`?
- No, it’s **not compatible** with Laravel’s native `Http::fake()`. Phiremock-common is tailored for Phiremock’s custom server/client architecture, which operates outside Laravel’s built-in testing tools. Use cases like dynamic mock responses or persistent staging servers require Phiremock’s full suite.
- What PHP 8.2 features does this package use, and will they break my app?
- The package leverages **PHP 8.2’s named arguments, union types, and read-only properties**. If your Laravel app uses deprecated PHP 8.1 functions (e.g., `array_key_first()`) or lacks union type support, you’ll need to refactor before upgrading. Run `php -v` and audit your codebase for compatibility.
- How does `phiremock-common` improve performance in CI/CD?
- Phiremock’s mock servers can **slow down CI/CD** due to startup overhead. Mitigate this by caching Docker volumes for persistent mock servers or using Phiremock’s built-in reset features to avoid test pollution. For lightweight tests, Laravel’s `Http::fake()` may still be faster.
- Are there alternatives to Phiremock for Laravel HTTP mocking?
- Yes. For **simple mocks**, use Laravel’s `Http::fake()` or **Mockery**. For **contract testing**, consider **PestPHP’s HTTP plugins** or **VCR-like tools** (e.g., `vcr/vcr`). Phiremock shines for **dynamic responses, latency simulation, or staging environments**, but adds complexity—weigh the trade-offs.
- Can I use this package in production, or is it testing-only?
- While primarily designed for **testing**, Phiremock-common *can* support production mocking (e.g., staging APIs). However, its **GPL-3.0 license** may restrict commercial use—consult your legal team. For production, ensure mock servers are **idempotent** and isolated from live traffic.
- How do I handle Phiremock’s dependency on PHP 8.2 if my team resists upgrades?
- Assess the **ROI of Phiremock** vs. the upgrade cost. If your team uses **Laravel 9**, consider forking this package to drop PHP 8.2 requirements (risky) or switch to alternatives like `mockery/mockery` for simpler mocks. Phiremock’s advanced features may not justify the migration.
- What happens if `phiremock-common` or Phiremock stops being maintained?
- The package’s **GPL-3.0 license** allows forking, but long-term viability depends on Phiremock’s ecosystem. Monitor its GitHub activity and consider **abstracting dependencies** behind interfaces (e.g., `MockHttpServerInterface`) to reduce coupling. For critical projects, document a fallback plan (e.g., custom traits or Dockerized mocks).