'Class 'SimpleSoftwareIO\QrCode\QrCodeServiceProvider' not found in laravel 7

my php version is 7.4 and laravel version is 7.0

'providers' => [SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,],

Alias

'aliases' => ['QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class,],

In my composer.json file

"require": {
    "php": "^7.2.5",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^1.0",
    "guzzlehttp/guzzle": "^6.3",
    "laravel/framework": "^7.0",
    "laravel/tinker": "^2.0",
    "simplesoftwareio/simple-qrcode": "^3.0"
},

here is error image

After adding alias and provider cant able to run any command in laravel root path its shows error like this

In ProviderRepository.php line 208: Class 'SimpleSoftwareIO\QrCode\QrCodeServiceProvider' not found


Solution 1:[1]

I use Laravel7 and I found solution. After install QR "simplesoftwareio/simple-qrcode": "^3.0"

  1. (Don't Add this in config/app.php) 'providers' and 'aliases' on config/app.php
#'providers' => [SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,],
#'aliases' => ['QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class,],
  1. try add qr in your blade template test.blade.php
{!! QrCode::size(250)->generate('www.google.com'); !!} 
  1. it work for me

Solution 2:[2]

Under config\app.php update like this:

Providers:

SimpleSoftwareIO\QrCode\ServiceProvider::class,

Aliases:

'QrCode' => SimpleSoftwareIO\QrCode\Facade::class,

Or remove this provider and .

Solution 3:[3]

None of the answers worked for me. Here is how I fixed it on Laravel 9 with PHP8.

First, we have to install the PHP GD library.

sudo apt-get install php-gd

Install Simple QRcodde version 4 or higher.

composer require simplesoftwareio/simple-qrcode "~4" --with-all-dependencies

No needs to change config/app.php.

We can simply use it on blade view file:

{!! QrCode::size(250)->generate('mailto:[email protected]'); !!} 

Solution 4:[4]

Execute on command line composer dump-autoload and you can call from aliases \QrCode::method()

Solution 5:[5]

Route::get('qr-code-g', function () {
\QrCode::size(500)
        ->format('svg')
        ->generate('www.google.com', public_path('images/qrcode.png'));

return view('qrCode'); });strong text

change format to svg

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PTucky Eagle
Solution 2 devugur
Solution 3 Dumindu Perera
Solution 4 Vildan Bina
Solution 5 v GANESH