Integrating PHP Social Stream into Laravel 5

1. Copy the “social-stream” folder into your Laravel project public folder (~/public) where your images, css, fonts or any public contents are stored.

2. Create a view file named “socialstream.php” in the views directory (~/resources/views) and put your social_stream() integration code in it. Example:

[code php]
echo social_stream(
array(
‘id’ => ‘1’,
‘type’ => ‘wall’,
‘network’ => array(
‘facebook’ => array(
‘facebook_id_1’ => array(
‘80655071208’ // Replace with your Facebook page ID
),
‘facebook_pagefeed’ => ‘posts’
),
‘instagram’ => array(
‘instagram_id_1’ => array(
‘katyperry’ // Replace with your Instagram username
)
)
),
‘theme’ => ‘sb-modern-light’,
‘itemwidth’ => 250,
‘results’ => 30,
‘iframe’ => ‘media’,
‘breakpoints’ => array(‘4’, ‘4’, ‘3’, ‘3’, ‘2’, ‘1’, ‘1’), // Number of items (columns) shwoing on each row for different viewport sizes
‘debuglog’ => 1,
‘add_files’ => true
)
);
[/code]

3. Create a controller file named “SocialStreamController.php” in the controllers directory (~/app/Http/Controllers) and bind the code to your view using the following commands.

[code]
namespace App\Http\Controllers;

class SocialStreamController extends Controller {

public function __construct()
{
$this->middleware(‘guest’);
}

public function index()
{
include(public_path() . ‘/social-stream/social-stream.php’);
return view(‘socialstream’);
}
}
[/code]

4. Add the following lines into your Laravel project routes file (~/routes/web.php) to tell the application to run the conntrolller SocialStream when the path “/socialstream” is requested.

[code]
Route::get(‘/socialstream’, ‘SocialStreamController@index’);
[/code]

5. Now your Social Stream Page is ready. Just request it by your browser from “/socialstream” or “http://localhost/your-project/public/socialstream”.

6. Finish.