PHP code example of splashlab / yii-facebook-opengraph

1. Go to this page and download the library: Download splashlab/yii-facebook-opengraph library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

splashlab / yii-facebook-opengraph example snippets

 Yii::app()->facebook->ogTags['og:title'] = "My Page Title"; 
 $this->widget('\YiiFacebook\Plugins\LikeButton', [
         //'href' => 'YOUR_URL', // if omitted Facebook will use the current page URL
         'show_faces'=>true,
         'share' => true
    ]); 
 Yii::app()->facebook->addJsCallback($js); 
 $accessToken = Yii::app()->facebook->getAccessToken() 
 $accessToken = Yii::app()->facebook->getLongLivedAccessToken() 
 $loginUrl = Yii::app()->facebook->getLoginUrl($redirect_url_after_login) 
 $reRequestUrl = Yii::app()->facebook->getReRequestUrl() 
 $reAuthenticationUrl = Yii::app()->facebook->getReAuthenticationUrl() 
 $signedRequest = Yii::app()->facebook->getSignedRequest() 
 $logoutUrl = Yii::app()->facebook->getLogoutUrl('http://example.com/after-logout') 
 $graphPageObject = Yii::app()->facebook->get('/me')->getUserNode() 
 $graphPageObject = Yii::app()->facebook->get('/SOME_PAGE_ID')->getPageNode() 
 $response = Yii::app()->facebook->post('/me/feed', [
                        'message' => 'User provided message'
                        'link' => 'www.example.com',
                    ])->getGraphNode() 
 Yii::app()->facebook->$fb->delete('/{node-id}') 

    try {
        $response = Yii::app()->facebook->fb->post('/me/feed', [
            'link' => 'www.example.com',
            'message' => 'User provided message'
        ])->getGraphNode()
        echo "Posted with id: " . $response->getField('id');
    } catch (\Facebook\Exceptions\FacebookSDKException $e) {
        // your own error handlers
        echo "Exception occurred, code: " . $e->getCode();
        echo " with message: " . $e->getMessage();
    }
    
 Yii::app()->facebook->destroySession() 
 $fb_user_id = Yii::app()->facebook->getUserId() 
 $graphUserObject = Yii::app()->facebook->getMe() // gets the Graph info of the current user 
 $graphUserObject = Yii::app()->facebook->getGraphUser($user_id) // gets the Graph object of the current user 
 $imageUrl = Yii::app()->facebook->getProfilePicture('large') // gets the Facebook picture URL of the current user 
 $imageUrl = Yii::app()->facebook->getProfilePicture(['height'=>300,'width'=>300]) // $size can also be specific 
 $imageUrl = Yii::app()->facebook->getProfilePictureById($openGraphId, $size) // gets the Facebook picture URL of a given OG entity