Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar

Installing laravel/legacy-factories package

When trying to install laravel/legacy-factories, I got the following messages:

D:\xampp82\htdocs\hyundai_unite_12>composer require laravel/legacy-factories ./composer.json has been updated Running composer update laravel/legacy-factories Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (including require-dev) Nothing to install, update or remove Generating optimized autoload files Warning: Ambiguous class resolution, "League\Flysystem\Local\FallbackMimeTypeDetector" was found in both "D:/xampp82/htdocs/hyundai_unite_12/vendor/league/flysystem-local\FallbackMimeTypeDetector.php" and "D:/xampp82/htdocs/hyundai_unite_12/vendor/league/flysystem/src\Local\FallbackMimeTypeDetector.php", the first will be used. Warning: Ambiguous class resolution, "League\Flysystem\Local\LocalFilesystemAdapter" was found in both "D:/xampp82/htdocs/hyundai_unite_12/vendor/league/flysystem-local\LocalFilesystemAdapter.php" and "D:/xampp82/htdocs/hyundai_unite_12/vendor/league/flysystem/src\Local\LocalFilesystemAdapter.php", the first will be used. Warning: Ambiguous class resolution, "League\Flysystem\Local\LocalFilesystemAdapterTest" was found in both "D:/xampp82/htdocs/hyundai_unite_12/vendor/league/flysystem-local\LocalFilesystemAdapterTest.php" and "D:/xampp82/htdocs/hyundai_unite_12/vendor/league/flysystem/src\Local\LocalFilesystemAdapterTest.php", the first will be used. Class App\Exceptions\Handler located in D:/xampp82/htdocs/hyundai_unite_12/app\Exceptions\Handler_ori.php does not comply with psr-4 autoloading standard. Skipping.

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

In Auth.php line 93:

In order to use the Auth::routes() method, please install the laravel/ui packa ge.

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

D:\xampp82\htdocs\hyundai_unite_12>

The result is:

"require": { "laravel/legacy-factories": "*"

Is it normal to see package with a star version?

0 likes
2 replies
LaryAI's avatar

Certainly! Let’s address each part of your question and the issues you’re seeing:

1. Is it normal to see "laravel/legacy-factories": "*" in composer.json?

Yes, it is valid, but not recommended. The asterisk (*) means "allow any version" of the package, which can lead to unexpected updates and potential incompatibilities. It's better to specify a version constraint, for example:

"laravel/legacy-factories": "^1.3"

You can find the latest version on Packagist.


2. Why does Composer say "Nothing to install, update or remove"?

This usually means the package is already installed, or your current dependencies already satisfy the requirements. You can check if it's present in your vendor/laravel/legacy-factories directory.


3. Ambiguous class resolution warnings

These warnings:

Warning: Ambiguous class resolution, "League\Flysystem\Local\FallbackMimeTypeDetector" was found in both ...

mean that you have duplicate classes in different locations. This often happens if you have conflicting versions of league/flysystem and league/flysystem-local. To fix:

  • Run composer why league/flysystem-local and composer why league/flysystem to see what is requiring these packages.
  • Try cleaning up your vendor directory and re-installing:
rm -rf vendor/
composer clear-cache
composer install

If the problem persists, check your composer.json for conflicting dependencies.


4. PSR-4 Autoloading warning

Class App\Exceptions\Handler located in .../Handler_ori.php does not comply with psr-4 autoloading standard. Skipping.

This means you have a file (Handler_ori.php) that contains a class (App\Exceptions\Handler) that doesn't match the file name or namespace. Either rename the file to match the class or remove it if it's not needed.


5. Error about Auth::routes()

In order to use the Auth::routes() method, please install the laravel/ui package.

This means you are using Auth::routes() in your routes file, but the laravel/ui package is not installed. To fix:

composer require laravel/ui
php artisan ui vue --auth

Or, if you only need the authentication scaffolding:

composer require laravel/ui
php artisan ui:auth

Summary of Steps

  1. Specify a version for laravel/legacy-factories in composer.json.
  2. Clean up vendor directory and re-install dependencies.
  3. Fix PSR-4 issues by renaming or removing incorrectly named files.
  4. Install laravel/ui if you use Auth::routes().

Example composer.json snippet:

"require": {
    "laravel/legacy-factories": "^1.3",
    "laravel/ui": "^3.4"
}

Example terminal commands:

rm -rf vendor/
composer clear-cache
composer install
composer require laravel/ui
php artisan ui:auth

If you follow these steps, your issues should be resolved! If you encounter further errors, please provide the updated error messages.

martinbean's avatar

@davy_yg Why on earth are you trying to use that package in the first place? The legacy factories were deprecated in Laravel 8.x, many years ago.

Please or to participate in this conversation.