laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.34k stars 130 forks source link

Fix: Correct vendor directory path resolution for Laravel Artisan Tinker command #178

Closed jubayed closed 5 months ago

jubayed commented 5 months ago

Overview

This pull request addresses an issue with the Laravel Artisan Tinker command where the vendor directory path might not be correctly determined. This fix ensures that the correct vendor directory is used, resolving issues with running the Laravel Artisan Tinker command in various environments.

Changes

Detailed Changes

use use Composer\InstalledVersions;
$vendorDir = Env::get('COMPOSER_VENDOR_DIR', $this->getLaravel()->basePath().DIRECTORY_SEPARATOR.'vendor');

if (!is_dir($vendorDir)) {
    $vendorDir = realpath(InstalledVersions::getRootPackage()['install_path'] . '/vendor');
}

$path = $vendorDir . '/composer/autoload_classmap.php';

Impact

This fix will ensure the Laravel Artisan Tinker command functions correctly in various deployment environments, particularly where the vendor directory might be customized or not present by default.