Search code examples
phplaravelcomposer-phplaragon

How to setup laravel using laragon in windows


enter image description here

There is error:

Warning: require(C:\laragon\www\sprii\public/../vendor/autoload.php): Failed to open stream: No such file or directory in C:\laragon\www\sprii\public\index.php on line 34

Fatal error: Uncaught Error: Failed opening required 'C:\laragon\www\sprii\public/../vendor/autoload.php' (include_path='.;C:/laragon/etc/php/pear') in C:\laragon\www\sprii\public\index.php:34 Stack trace: #0 {main} thrown in C:\laragon\www\sprii\public\index.php on line 34

I try to composer update and comes out this error. why?

After try to run "composer dump-autoload", come out this error

Generating optimized autoload files
Class App\Http\Controllers\api\v1\TwoFactorApiController located in C:/laragon/www/sprii/app\Http\Controllers\Api\V1\TwoFactorApiController.php does not comply with psr-4 autoloading standard. Skipping.
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> @php artisan package:discover --ansi
    Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\laragon\www\sprii\bootstrap\app.php:14
    Stack trace:
    #0 C:\laragon\www\sprii\artisan(20): require_once()
    #1 {main}
      thrown in C:\laragon\www\sprii\bootstrap\app.php on line 14
    Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255


Solution

  • Remove your compose.lock file.

    Right-click on laragon icon in system tray and thick extensions:

    Laragon->PHP->Extensions->Sodium & pdo_sqlite 
    

    enabling php extensions

    Run cmd as administrator and then run these:

    composer install --ignore-platform-reqs
    composer dump-autoload
    composer update --ignore-platform-reqs