I'm trying to get the minimal example
using Facebook\FacebookSession;
FacebookSession::setDefaultApplication('YOUR_APP_ID','YOUR_APP_SECRET');
// Use one of the helper classes to get a FacebookSession object.
// FacebookRedirectLoginHelper
// FacebookCanvasLoginHelper
// FacebookJavaScriptLoginHelper
// or create a FacebookSession with a valid access token:
$session = new FacebookSession('access-token-here');
// Get the GraphUser object for the current user:
try {
$me = (new FacebookRequest(
$session, 'GET', '/me'
))->execute()->getGraphObject(GraphUser::className());
echo $me->getName();
} catch (FacebookRequestException $e) {
// The Graph API returned an error
} catch (\Exception $e) {
// Some other error occurred
}
from the README working, but I don't understand what the first line of code means. Where do I have to put the PHP file using that minimal code example within the SDK file structure. I tried directly in the src folder, but that returns the following PHP error
[01-May-2014 20:12:26 Europe/Berlin] PHP Parse error: syntax error, unexpected 'Facebook' (T_STRING) in /Applications/MAMP/htdocs/facebook-php-sdk-v4/src/test.php on line 9
The file structure looks like this
├── src
│ ├── Facebook
│ │ ├── FacebookAuthorizationException.php
│ │ ├── FacebookCanvasLoginHelper.php
│ │ ├── FacebookClientException.php
│ │ ├── FacebookJavaScriptLoginHelper.php
│ │ ├── FacebookOtherException.php
│ │ ├── FacebookPermissionException.php
│ │ ├── FacebookRedirectLoginHelper.php
│ │ ├── FacebookRequest.php
│ │ ├── FacebookRequestException.php
│ │ ├── FacebookResponse.php
│ │ ├── FacebookSDKException.php
│ │ ├── FacebookServerException.php
│ │ ├── FacebookSession.php
│ │ ├── FacebookThrottleException.php
│ │ ├── GraphLocation.php
│ │ ├── GraphObject.php
│ │ ├── GraphSessionInfo.php
│ │ ├── GraphUser.php
│ │ └── fb_ca_chain_bundle.crt
│ └── test.php