Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phiremock Laravel Package

mcustiel/phiremock

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Accelerate API-Dependent Development: Enable teams to mock external HTTP/REST services (e.g., payment gateways, SaaS APIs) during local development, reducing reliance on live dependencies and speeding up iteration cycles. Critical for Laravel apps with tight coupling to third-party APIs.
  • CI/CD Stability: Eliminate flaky tests caused by external API failures (timeouts, rate limits, or downtime) by replacing them with deterministic mocks. Reduces false negatives in pipelines and improves test reliability.
  • Cost Optimization: Avoid unnecessary API calls during development/testing, preserving quotas for production (e.g., AWS Lambda, Stripe, or Twilio APIs) and reducing costs associated with overage fees.
  • Stateful Testing for Complex Workflows: Support multi-step API interactions (e.g., OAuth flows, sequential API calls) with features like:
    • Prioritized expectations (resolve conflicts when multiple mocks match).
    • Stateful mocking (persist expectations across requests).
    • Request verification (assert how many times an endpoint was called).
  • Testing Framework Integration: Seamlessly integrate with Codeception (via dedicated extensions/modules), enabling teams to adopt Phiremock without disrupting existing test workflows. Lowers the barrier to adoption for QA engineers.
  • Build vs. Buy Decision: Avoid reinventing a mocking solution (e.g., custom PHP scripts or Java-based WireMock) by leveraging a PHP-native, open-source alternative with RESTful configuration. Reduces technical debt and maintenance overhead.
  • Roadmap for Observability: Lay the foundation for future enhancements like:
    • Request replay/recording (capture real API traffic for later mocking).
    • Mock analytics (track API usage patterns in development).
    • Distributed mocking (scale mocks across microservices).

When to Consider This Package

Adopt if:

  • Your primary stack is PHP/Laravel, and you need to mock HTTP/REST services for development, testing, or CI/CD.
  • You require granular control over mock responses, including:
    • Dynamic responses (e.g., generate replies based on request data).
    • Latency simulation (e.g., mimic slow APIs for performance testing).
    • Regex or exact matching for requests (headers, URL, body).
  • You’re using Codeception or want to integrate mocking into existing PHP test suites without adding Java dependencies.
  • You prioritize cost efficiency and want to avoid unnecessary API calls during development (e.g., preserving quotas for Stripe, Twilio, or AWS services).
  • Your team prefers PHP-native tools over Java-based alternatives (e.g., WireMock) to simplify the development environment.

Look elsewhere if:

  • You need a graphical UI for non-technical stakeholders (consider Postman Mock Servers or Mockoon).
  • Your use case requires real-time API prototyping (e.g., designing APIs before implementation).
  • You’re working in a non-PHP stack (e.g., Node.js, Python) and need native integration.
  • You require active maintenance (last release was 2021; evaluate risks of unpatched vulnerabilities or breaking changes with newer PHP/Laravel versions).
  • You need advanced features like:
    • Request recording (capture live API traffic for later mocking).
    • Distributed mocking (scale across microservices).
    • GraphQL support (Phiremock is HTTP/REST-focused).
  • Your team is already using Laravel’s built-in HTTP testing (Http::fake()) or Pest’s HTTP plugins, which may suffice for simpler use cases.

How to Pitch It (Stakeholders)

For Executives: *"Phiremock is a PHP-native API mocking tool that lets our Laravel teams eliminate dependencies on external services during development and testing. By replacing unreliable third-party APIs with controlled mocks, we:

  • Reduce CI/CD failures caused by external downtime or rate limits.
  • Cut API costs by avoiding unnecessary calls during testing (e.g., Stripe, Twilio, or AWS quotas).
  • Accelerate feature delivery by enabling parallel development without waiting for API access.
  • Lower technical debt by avoiding custom mocking solutions or Java-based tools like WireMock.

It’s a lightweight, open-source alternative that integrates seamlessly with our existing PHP stack—no new languages or tools required. The tradeoff? It’s not actively maintained, so we’d need to monitor for updates or plan for potential forks. But for now, it’s a high-leverage way to stabilize our testing and development workflows."*


For Engineering/DevOps: *"Phiremock is a WireMock-like mocker for PHP that lets you:

  • Stub HTTP/REST APIs with fine-grained control (regex, exact matching, headers, body).
  • Simulate latency and prioritize responses for complex test scenarios.
  • Verify API calls (e.g., ‘Was this endpoint called exactly 3 times?’).
  • Load mocks from JSON for reusable, version-controlled test setups.
  • Proxy requests to real APIs when needed (hybrid testing).
  • Integrate with Codeception via extensions, making it a drop-in solution for PHP test suites.

Key advantages over alternatives:

Feature Phiremock Laravel Http::fake() WireMock (Java)
PHP-native ✅ Yes ✅ Yes ❌ No (Java dependency)
Regex matching ✅ Yes ❌ No ✅ Yes
Latency simulation ✅ Yes ❌ No ✅ Yes
Stateful mocking ✅ Yes ❌ No ✅ Yes
Codeception support ✅ Yes (extensions) ❌ No ❌ No
Active maintenance ❌ No (last release: 2021) ✅ Yes (Laravel core) ✅ Yes

Risks:

  • No active maintenance: May require forks or manual patches for PHP 8.2+/Laravel 10+ compatibility.
  • Performance overhead: Runs as a sidecar service (adds ~50–100ms latency vs. in-memory mocks).
  • Dependency age: Relies on older versions of react/http and symfony/cache (potential CVEs).

Recommendation: Use Phiremock for complex API mocking needs where Laravel’s Http::fake() is insufficient, but monitor for forks or alternatives (e.g., Pest’s HTTP testing). For simple cases, prefer Laravel’s built-in tools."*


For QA/Test Engineers: *"Phiremock turns unpredictable APIs into reliable test doubles. Here’s how it helps you:

  • Isolate tests from third-party failures (e.g., payment gateways, weather APIs).
  • Create dynamic mocks: Use request data to generate realistic responses (e.g., return a 401 if auth: false is sent).
  • Test complex workflows: Simulate sequences (e.g., ‘First call returns a token; second call uses it’) with stateful mocking.
  • Verify API usage: Assert how many times an endpoint was called or validate request patterns.
  • Reuse mocks: Define expectations in JSON files and share them across the team or projects.
  • Codeception plugins: Set up mocks in seconds without Java or extra tools.

Example Use Cases:

  1. Payment Gateway Testing: Mock Stripe/PayPal responses without hitting live APIs.
  2. OAuth Flows: Simulate token exchanges and multi-step authentication.
  3. CI/CD Stability: Eliminate flaky tests caused by external API timeouts.
  4. Performance Testing: Add artificial latency to test error handling.

Setup Tip: Use the REST API to manage stubs dynamically or load them from JSON files for version control. For Codeception, the [phiremock-codeception-extension](https://github.com/mcustiel/phiremock-codeception-extension) makes integration trivial.

Tradeoff: It’s not actively maintained, so check for compatibility with your PHP/Laravel version before adopting."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime