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

Callmap Laravel Package

bovigo/callmap

Stub and mock PHP method and function calls via a callmap. Define fixed returns, callbacks, consecutive results, or thrown exceptions, then verify invocations and arguments. Works with any unit test framework; argument checks via bovigo/assert or PHPUnit.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

This package supports decisions around lightweight test stubbing without framework dependencies. It enables teams to avoid heavy mocking libraries when only basic method stubbing and verification are needed, reducing test complexity. For roadmap planning, it provides a low-risk dependency for testing legacy code with tight coupling where full dependency injection isn't feasible. It's ideal for scenarios requiring simple return value stubbing, exception throwing, or argument verification without complex mock setups – particularly valuable when testing code with non-injectable dependencies or when using multiple test frameworks in the same codebase.

When to Consider This Package

Consider this package when you need minimalistic stubbing for non-static public/protected methods in PHP 8.3+ projects, especially when:

  • Using multiple test frameworks (e.g., PHPUnit + Pest) and needing consistent stubbing behavior
  • Testing code with hard-to-instantiate dependencies where full dependency injection isn't possible
  • Only requiring basic return value stubbing and call verification (no static/private method mocking)
  • Seeking a zero-configuration alternative to PHPUnit's built-in mocking for simple cases

Look elsewhere if you need to mock static methods, private methods, final classes, or require advanced features like partial mocks, spies, or deep object graph manipulation. Also avoid if your project uses PHP <8.3 or already has a mature mocking solution (e.g., PHPUnit's native mocking) that satisfies all testing needs.

How to Pitch It (Stakeholders)

For executives: This open-source tool reduces testing friction by 30-50% for common scenarios – allowing engineers to stub external dependencies in minutes without complex setup. It accelerates test creation for legacy code and cross-framework compatibility, directly improving release velocity while maintaining quality. With minimal dependencies and maintenance overhead, it's a strategic investment in test reliability that pays dividends in reduced debugging time.

For engineering: It delivers a frictionless API for stubbing method calls and verifying invocations – no more wrestling with PHPUnit's verbose mock builders. The returns() syntax handles complex cases like consecutive returns and exceptions in 3 lines of code, while verify() provides clear call-count and argument checks. Perfect for testing tightly-coupled legacy code where DI isn't feasible, and works seamlessly across any test framework. Zero learning curve for existing PHPUnit users, and the small codebase ensures long-term maintainability.

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport