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

Php Autoload Override Laravel Package

adriansuter/php-autoload-override

Override fully qualified function calls inside PHP class methods so you can mock them in tests. Works with Composer PSR-4 autoloading (PHP 8.2+). Use OverrideFactory to map functions (e.g., rand) to custom implementations for deterministic PHPUnit tests.

View on GitHub
Deep Wiki
Context7
2.1

Added MockRegistry (src/MockRegistry.php) A scoped, type-safe alternative to the $GLOBALS pattern used inside override closures. Supports per-class overrides, a global fallback, and granular reset methods. Existing $GLOBALS usage remains fully supported.

Added OverrideFactory (src/OverrideFactory.php) A fluent builder that reduces bootstrap scripts to concise declarations. Accepts real function implementations as first-class callables and applies the lazy MockRegistry pattern automatically. Supports apply() for direct registration and build() for returning the raw declarations array.

Updated documentation

  • All examples migrated from $GLOBALS to MockRegistry and OverrideFactory
  • Composer version constraint corrected to ^2.0
  • Caching limitations section expanded to cover OPcache, including a recommended phpunit.xml.dist snippet
  • PHPUnit examples modernised (#[Test], assertSame, void return types)
2.0
  • Drops support for php versions lower than 8.2.
  • Updates dependencies.
1.5
  • Fix the installation instructions so that this library works with PHP 8.2.
  • Minor code refactoring.
1.4
  • Prepare support for php 8.2
1.3
  • Drop PHP 7.2 support
  • Prepare PHP 8.1 support
  • Update phpunit
1.2
  • Drop PHP 7.1 support
  • Prepare PHP 8 support
  • Update phpunit
1.1

Changes

  • Minor improvements.
  • phpstan added.
1.0

Version 1 is feature complete.

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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata