minor #1296 [Mate] Add support for _composer_autoload_path super global (Nyholm)

This PR was merged into the main branch.

Discussion
----------

[Mate] Add support for _composer_autoload_path super global

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Docs?         | no
| Issues        | no
| License       | MIT

If `$_GLOBALS['_composer_autoload_path']` is defined, then use it. It is defined my composer on each "bin" script.

(See your `vendor/bin/*`)

Commits
-------

da436902 add support for _composer_autoload_path super global
This commit is contained in:
Tobias Nyholm
2025-12-28 11:48:02 +01:00

View File

@@ -15,6 +15,10 @@ $autoloadPaths = [
__DIR__.'/../vendor/autoload.php', // Package autoloader (fallback)
];
if (isset($GLOBALS['_composer_autoload_path'])) {
array_unshift($autoloadPaths, $GLOBALS['_composer_autoload_path']);
}
$root = null;
foreach ($autoloadPaths as $autoloadPath) {
if (file_exists($autoloadPath)) {