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.

Blade template tags in Laravel

Laravel use cascading template engine Blade. It has interesting tags I should write down to remember before I completely forgot what they mean.

Tags as below,


Here’s the full list

  • {{ $var }}

    – Echo content

  • {{ $var or 'default' }}

    – Echo content with a default value

  • {{{ $var }}}

    – Echo escaped content

  • {{-- Comment --}}

    – A Blade comment

  • @extends('layout')

    – Extends a template with a layout

  • @if(condition)

    – Starts an if block

  • @else

    – Starts an else block

  • @elseif(condition)

    – Start a elseif block

  • @endif

    – Ends a if block

  • @foreach($list as $key => $val)

    – Starts a foreach block

  • @endforeach

    – Ends a foreach block

  • @for($i = 0; $i < 10; $i++)

    – Starts a for block

  • @endfor

    – Ends a for block

  • @while(condition)

    – Starts a while block

  • @endwhile

    – Ends a while block

  • @unless(condition)

    – Starts an unless block

  • @endunless

    – Ends an unless block

  • @include(file)

    – Includes another template

  • @include(file, ['var' => $val,...])

    – Includes a template, passing new variables.

  • @each('file',$list,'item')

    – Renders a template on a collection

  • @each('file',$list,'item','empty')

    – Renders a template on a collection or a different template if collection is empty.

  • @yield('section')

    – Yields content of a section.

  • @show

    – Ends section and yields its content

  • @lang('message')

    – Outputs message from translation table

  • @choice('message', $count)

    – Outputs message with language pluralization

  • @section('name')

    – Starts a section

  • @stop

    – Ends section

  • @endsection

    – Ends section

  • @append

    – Ends section and appends it to existing of section of same name

  • @overwrite

    – Ends section, overwriting previous section of same name