How to use Solarium (3.6.0) with Laravel 5.2

After hours of research falling into traps referring examples of different versions, finally managed to figure out the correct one.

1. Create `app/config/solr.php`

<?php

return array(
    'endpoint' => array(
        'key' => array(
            'host' => '127.0.0.1',
            'port' => 8983,
            'path' => '/solr/',
            'core' => 'mycore'
        )
    )
);

2. Add the following code to HomeController

<?php namespace App\Http\Controllers;  use Illuminate\Support\Facades\Config;  use Solarium\Core\Client\Client;  use Solarium_Exception;  class HomeController extends Controller {      protected $client;          public function __construct()     {          $configSolr = Config::get('solr');          $this->client = new Client($configSolr);
    }
public function index()
{
// create a ping query
$client = $this->client;
$ping = $client->createPing();
// execute the ping query
$result ='';
try {
$result = $client->ping($ping);
echo 'Ping query successful';
echo '<br?>';
var_dump($result->getData());
} catch (Solarium_Exception $e) {
echo 'Ping query failed';
var_dump($e);
}
return $result;
}
}