2017 © Pedro Peláez
 

library evernote

Evernote PHP SDK

image

evernote/evernote

Evernote PHP SDK

  • Monday, April 4, 2016
  • by rekotan
  • Repository
  • 41 Watchers
  • 250 Stars
  • 21,252 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 61 Forks
  • 4 Open issues
  • 8 Versions
  • 2 % Grown

The README.md

Evernote SDK for PHP

Evernote API version 1.26, (*1)

Overview

This SDK contains wrapper code used to call the Evernote Cloud API from PHP., (*2)

The SDK also contains two samples. The code in sample/client demonstrates the basic use of the SDK for single-user scripts. The code in sample/oauth demonstrates the basic use of the SDK for web applications that authenticate using OAuth., (*3)

Prerequisites

This SDK makes use of PHP namespaces, and as such requires PHP 5.3 or later., (*4)

In order to use the code in this SDK, you need to obtain an API key from http://dev.evernote.com/documentation/cloud. You'll also find full API documentation on that page., (*5)

In order to run the sample code, you need a user account on the sandbox service where you will do your development. Sign up for an account at https://sandbox.evernote.com/Registration.action, (*6)

In order to run the client sample code, you need a developer token. Get one at https://sandbox.evernote.com/api/DeveloperToken.action, (*7)

Getting Started - Client

The code in sample/client/EDAMTest.php demonstrates the basics of using the Evernote API, using developer tokens to simplify the authentication process while you're learning., (*8)

  1. Open sample/client/EDAMTest.php
  2. Scroll down and fill in your Evernote developer token.
  3. On the command line, run the following command to execute the script:, (*9)

    php EDAMTest.php, (*10)

Getting Started - OAuth

Web applications must use OAuth to authenticate to the Evernote service. The code in sample/oauth contains a simple web app that demonstrates the OAuth authentication process., (*11)

  1. Open the file sample/oauth/config.php
  2. Fill in your Evernote API consumer key and secret.
  3. Deploy the sample/oauth directory to your web server
  4. Load the web application in your browser (e.g. http://localhost/oauth)

There are two pages in the sample. index.php demonstrates each step of the OAuth process in detail. This is useful for developers, but not what an end user would see. sampleApp.php demonstrates the simplified process, which is similar to what you would implement in your production app., (*12)

Getting Started - OAuth with Opauth

  1. Install the dependencies, (*13)

    cd sample/oauth_with_opauth, (*14)

    php composer.phar install, (*15)

  2. Install the Strategy, (*16)

    cd sample/oauth_with_opauth/vendor/opauth/opauth/lib/Opauth/Strategy/README.md, (*17)

    git clone git://github.com/evernote/opauth-evernote.git Evernote, (*18)

  3. Open the file sample/oauth_with_opauth/config.php, (*19)

  4. Fill in your Evernote API consumer key and secret.
  5. Fill the 'dir' key as follow :, (*20)

    If your url is http://localhost/oauth_with_opauth, path should be set to '/oauth_with_opauth/auth/', (*21)

  6. Deploy the sample/oauth_with_opauth directory to your web server, (*22)

  7. Load the web application in your browser (e.g. http://localhost/oauth_with_opauth)

Installing SDK using Composer

Using Composer is one of the options to install Evernote SDK for PHP., (*23)

  1. Add "evernote/evernote" as a dependency in your project's composer.json file., (*24)

    {
        "require": {
            "evernote/evernote": "dev-master"
        }
    }
    
  2. Download and install Composer., (*25)

    curl -s "http://getcomposer.org/installer" | php, (*26)

  3. Install your dependencies., (*27)

    php composer.phar install, (*28)

  4. Require Composer's autoloader by adding the following line to your code's bootstrap process., (*29)

    require '/path/to/sdk/vendor/autoload.php';, (*30)

Usage

OAuth

$client = new Evernote\Client(array(
  'consumerKey' => 'YOUR CONSUMER KEY',
  'consumerSecret' => 'YOUR CONSUMER SECRET'
));
$requestToken = $client->getRequestToken('YOUR CALLBACK URL');
$authorizeUrl = $client->getAuthorizeUrl($requestToken['oauth_token']);
 => https://sandbox.evernote.com/OAuth.action?oauth_token=OAUTH_TOKEN

To obtain the access token, (*31)

$accessToken = $client->getAccessToken(
  $requestToken['oauth_token'],
  $requestToken['oauth_token_secret'],
  $_GET['oauth_verifier']
);

Now you can make other API calls, (*32)

$token = $accessToken['oauth_token'];
$client = new Evernote\Client(array('token' => $token));
$noteStore = $client->getNoteStore();
$notebooks = $noteStore->listNotebooks();

UserStore

Once you acquire token, you can use UserStore. For example, if you want to call UserStore.getUser:, (*33)

$client = new Evernote\Client(array('token' => $token));
$userStore = $client->getUserStore();
$userStore->getUser();

You can omit authenticationToken in the arguments of UserStore/NoteStore functions., (*34)

NoteStore

If you want to call NoteStore.listNotebooks:, (*35)

$noteStore = $client->getNoteStore();
$noteStore->listNotebooks();

NoteStore for linked notebooks

If you want to get tags for linked notebooks:, (*36)

$linkedNotebooks = $noteStore->listLinkedNotebooks;
$linkedNotebook = $linkedNotebooks[0];
$sharedNoteStore = $client->sharedNoteStore($linkedNotebook);
$sharedNotebook = $sharedNoteStore->getSharedNotebookByAuth();
$sharedNoteStore->listTagsByNotebook($sharedNotebook->notebookGuid);

NoteStore for Business

If you want to get the list of notebooks in your business account:, (*37)

$businessNoteStore = $client->getBusinessNoteStore();
$businessNoteStore->listNotebooks();

The Versions

04/04 2016

dev-master

9999999-dev https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

04/04 2016

1.26.0

1.26.0.0 https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

12/06 2013

1.25.0

1.25.0.0 https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

12/06 2013

dev-dev

dev-dev https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

03/05 2013

1.24.0

1.24.0.0 https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

12/04 2013

1.23.3

1.23.3.0 https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

29/03 2013

1.23.3.x-dev

1.23.3.9999999-dev https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote

24/02 2013

1.23.1.x-dev

1.23.1.9999999-dev https://github.com/evernote/evernote-sdk-php

Evernote PHP SDK

  Sources   Download

Apache

The Requires

  • php >=5.3

 

api sdk evernote