infection/include-interceptor
PHP stream wrapper that intercepts the file:// protocol to override the content of any included or autoloaded file at runtime. Register a mapping from original file to replacement, enable the interceptor, and includes/file_get_contents load the replacement instead.
It's a Stream Wrapper that wraps a file:// protocol and allows overriding content of any (auto) loaded file, including files autoloaded by Composer package manager.
composer require infection/include-interceptor
If you want to replace the content of the file whenever it's loaded (by executing include '/path/to/file.php, by calling file_get_contents('/path/to/file.php'), etc.), you need to register IncludeInterceptor before loading original file:
use Infection\StreamWrapper\IncludeInterceptor;
IncludeInterceptor::intercept('/path/to/original_file.php', '/path/to/replacement_file.php');
IncludeInterceptor::enable();
After enabling IncludeInterceptor, content of the replacement_file.php will be loaded instead of content of the original_file.php.
dg/bypass-finals package that allows to mock final classes, by overriding original content and removing final keyword in runtimePlease read documentation here: infection.github.io
Twitter: @infection_php
How can I help you explore Laravel packages today?