SimpleSoftwareIO / simple-qrcode

An easy-to-use PHP QrCode generator with first-party support for Laravel.
https://www.simplesoftware.io/simple-qrcode
MIT License
2.72k stars 383 forks source link

Something needs to be solved this error while installing QRCode, especially for Laravel 9 users. #257

Closed AlexWS1048575 closed 2 years ago

AlexWS1048575 commented 2 years ago

Hello After I type composer require simplesoftwareio/simple-qrcode, it has no problem, but it shows this error message in the bottom.

Class SimpleSoftwareIO\QrCode\BaconQrCodeGenerator located in C:/xampp/htdocs/example-app2/vendor/simplesoftwareio/simple-qrcode/src\BaconQrCodeGenerator.php does not comply with psr-4 autoloading standard. Skipping.
Class SimpleSoftwareIO\QrCode\Facades\QrCode located in C:/xampp/htdocs/example-app2/vendor/simplesoftwareio/simple-qrcode/src\Facades\QrCode.php does not comply with psr-4 autoloading standard. Skipping.
Class SimpleSoftwareIO\QrCode\QrCodeInterface located in C:/xampp/htdocs/example-app2/vendor/simplesoftwareio/simple-qrcode/src\QrCodeInterface.php does not comply with psr-4 autoloading standard. Skipping.
Class SimpleSoftwareIO\QrCode\QrCodeServiceProvider located in C:/xampp/htdocs/example-app2/vendor/simplesoftwareio/simple-qrcode/src\QrCodeServiceProvider.php does not comply with psr-4 autoloading standard. Skipping.

My composer.json currently

"autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },

After I saw an error message, I add this to my config/app.php

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

when I want to make a controller, it won't work, it shows

Class "SimpleSoftwareIO\QrCode\QrCodeServiceProvider" not found

Anyone knows how to solve this issue? Especially for Laravel 9 users

eina84 commented 2 years ago

I have it working fine in Laravel 9.21. my providers & aliases are the same as yours in app.php.

I see mention of the class being skipped on installation. Does the class file exist? Mine is here: D:\xampp8_1_2\htdocs\myApp\vendor\simplesoftwareio\simple-qrcode\src\QrCodeServiceProvider.php

SimplyCorey commented 2 years ago

Don't know what's wrong. Feel free to open a PR to address this if something is wrong.