Laravel Socialite integration with composer update (and autoload)

After searching in the darkness for several hours.
I finally cleared out the relation between composer update and laravel autoload functionality.
And finally laravel Socialite works like a charm.

To start with, we have the “Official Doc” from Laravel doc 5.0, claiming its a painless integration for social auth in laravel. For dummy like me, I want to know why after registering facade by entering 2 lines in config/app.php would import a huge lib from github.
Of course the code would not be imported “on air” every time, and certainly I haven’t download the src code to my repos yet.

So by looking at the code, “Illuminate\Cache” are just namespaces.
While socialite using “Laravel\Socialite” as its namespace.
So clearly from namespace to find right path doesn’t work here.

Then back to composer.json changes. and along with another file composer.lock.

So the code must comes from here.
Looking at this useful link, it described composer install, composer update and composer dump-autoload pretty well.
So I may site in here:

  • composer install installs the vendor packages according to composer.lock (or creates composer.lock if not present),
  • composer update always regenerates composer.lock and installs the lastest versions of available packages based on composer.json
  • composer dump-autoload won’t download a thing. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php). Ideal for when you have a new class inside your project. (composer dump-autoload -o for better loading performance – unchecked)

So this must be the solution.
Then two line of code,

cd <laravel dir> && composer update
composer dump-autoload

Whoola, it worked.
In code,


will work without any FATAL.