Laravel 10: Class "League\Flysystem\AwsS3V3\PortableVisibilityConverter" not found – Laravel

by
Ali Hasan
amazon-s3 composer-php laravel

Quick Fix: Change the filesystem driver to local by setting FILESYSTEM_DISK=local in .env to generate the ide-helper.php file, and then change it back to s3 after generation.

The Problem:

While deploying a Laravel application to a production environment, the developer encounters an error indicating that the class "League\Flysystem\AwsS3V3\PortableVisibilityConverter" is not found. Despite installing the necessary dependencies and performing various troubleshooting steps, the issue persists.

The Solutions:

Solution 1: Downgrade Composer Versions

According to the solution, the issue might be related to using different Composer versions in the development and production environments. To resolve this, you can try downgrading your Composer version in the production environment to match the version used in development:

# Downgrade Composer version in production
rm -rf /path/to/production/app/storage/framework/cache/services.json
rm -rf /path/to/production/app/storage/framework/cache/eagerloaded_services.php
cd /path/to/production/app
mv /path/to/production/app/config/app.php{,.old}
mv /path/to/production/app/config/app.php.example /path/to/production/app/config/app.php
mv /path/to/production/app/config/services.php{,.old}
mv /path/to/production/app/config/services.php.example /path/to/production/app/config/services.php
COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISALLOW_ALPHAS=true COMPOSER_DISABLE_XDEBUG_HOOKS=true COMPOSER_DISABLE_INSTALL_SUGGESTS=true COMPOSER_PROCESS_TIMEOUT=900000 php /path/to/production/app/storage/framework/invoices/start - clear cache
php /path/to/production/app/storage/framework/invoices/start - run Composer update

Solution 2: Running composer command

To resolve the issue, simply run the following composer command:

“`
composer require league/flysystem-aws-s3-v3 “^3.0” –with-all-dependencies
“`

Solution 3: Check the PHP version

Check that the PHP version you are using is compatible with the library. The library requires PHP 8.1 or higher. You can check your PHP version by running the following command:

php -v

Q&A

in my prod environment I’m having this error while locally everything works perfectly.

I had the same issue while trying to generate an ide-helper.php file for development and realized that I was using the s3 filesystem driver.

What if I am running in production?

If you are using s3 as your driver in production then this will obviously not work.

What should I do?

Just running composer require league/flysystem-aws-s3-v3 "^3.0" --with-all-dependencies worked for me

Video Explanation:

The following video, titled "Laravel 10 full course for beginner - Intro to Routes - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

This Laravel tutorial teaches you the fundamentals of Laravel 10 Premium Laravel Course New and Updated In Depth Laravel 10 course ...