PHP code example of simivar / genius-php

1. Go to this page and download the library: Download simivar/genius-php 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/ */

    

simivar / genius-php example snippets




entication = new \Http\Message\Authentication\Bearer('YOUR_ACCESS_TOKEN');

$genius = new \Genius\Genius($authentication);
$upvoteAnnotation = $genius->getAnnotationsResource()->get(11852248);



$authentication = new \Genius\Authentication\OAuth2(
  'YOUR_CLIENT_ID',
  'YOUR_CLIENT_SECRET',
  'YOUR_REDIRECT_URL',
  new \Genius\Authentication\ScopeList([
      \Genius\Enum\Scope::ME(),
      \Genius\Enum\Scope::CREATE_ANNOTATION(),
      \Genius\Enum\Scope::MANAGE_ANNOTATION(),
      \Genius\Enum\Scope::VOTE(),
  ]),
  null
);

$accessTokenFromDatabase = 'get access token from DataBase here';
if ($accessTokenFromDatabase === null) {
    $authorizeUrl = $authentication->getAuthorizeUrl();
    // redirect user to $authorizeUrl
} else {
    $authentication->setAccessToken($accessTokenFromDatabase);
}

$genius = new \Genius\Genius($authentication);
$upvoteAnnotation = $genius->getAnnotationsResource()->get(11852248);

composer