api - laraval 5.1 it is showing that Class 'Facebook\Facebook' not found -
fb calling api uploading photos
<?php $fb = new facebook\facebook([ 'app_id' => '', 'app_secret' => '', 'default_graph_version' => 'v2.5', ]); $data = [ 'message' => 'my awesome photo upload example.', 'source' => $fb->filetoupload('c:/xampp/htdocs/laravel5-learning/public/image/share/'.$name), ]; try { // returns `facebook\facebookresponse` object $response = $fb->post('/me/photos', $data, '{access-token}'); } catch(facebook\exceptions\facebookresponseexception $e) { echo 'graph returned error: ' . $e->getmessage(); exit; } catch(facebook\exceptions\facebooksdkexception $e) { echo 'facebook sdk returned error: ' . $e->getmessage(); exit; } $graphnode = $response->getgraphnode(); echo 'photo id: ' . $graphnode['id']; ?>
classes using in controller file
i think need include more classes work good. please me in telling need call
use illuminate\http\request; //use session; //use request; use db; use datetime; //use app\locations; use app\http\requests; use app\http\controllers\controller; use facebook\facebook facebook; use facebook\fileupload\facebookfile; use facebook\facebookrequest; use facebook\graphobject; use facebook\facebookrequestexception;
is showing error class 'facebook\facebook' not found
just add socialite in composer using below command .
composer require laravel/socialite
if want explore more read this
happy coding :) .
Comments
Post a Comment