vendredi 26 août 2016

Laravel 5.3 how to add psr-4

Error Class 'Mylib\Mytest' not found

My routes/web.php

Route::get('/', function () {
   $rs = new Mylib\Mytest;
   //@FIXME:Del or comment this debug script in routes/web.php
    dd($rs);
    //return view('welcome');
});

composer.json

 "autoload": {
         "classmap": [
             "database"
         ],
         "psr-4": {
             "App\\": "app/",
              "Mylib\\": "src/"
        }
    },

src/Mytest.php

namespace src;

class Mytest
{   
     function theTest() {
          return true; 
    }
}

already run composer dump-autoload -o also run composer update



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire