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 global function calls inside class methods so you can mock them in tests. Works with PHP 8.2+ and Composer PSR-4 autoloading; integrates via a PHPUnit bootstrap using OverrideFactory to map functions (e.g., rand) to real implementations.

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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai