2017 © Pedro Peláez
 

yii2-extension yii2-scoop-it

scoop it function

image

humanized/yii2-scoop-it

scoop it function

  • Friday, January 26, 2018
  • by jeffrey.geyssens
  • Repository
  • 1 Watchers
  • 0 Stars
  • 92 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 Scoop.it - README

Yii2, (*1)

This package proposes a data model for importing and synchronising content locally managed through Scoop.it account, (*2)

Features

Dependencies

This package relies on Guzzle version 6.x., (*3)

Installation

Install Using Composer

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

$ php composer.phar require humanized/yii2-scoop-it "dev-master"

or add, (*6)

"humanized/yii2-scoop-it": "dev-master"

to the require section of your composer.json file., (*7)

Add Module to Configuration

Add following lines to the configuration file for minimum integration:, (*8)

'modules' => [
    'scoopit' => [
        'class' => 'humanized\scoopit\ScoopIt',
    ],
],

Further information about module configuration can be found on the CONFIG-file of this repository., (*9)

Run Migrations

$ php yii migrate/up --migrationPath=@vendor/humanized/yii2-scoop-it/migrations

Setup Scoop.it Credentials

Account credentials are stored as local parameters, e.g. storing them in common/config/params-local: Note, these credentials are personal and should never be stored on a public software repository!, (*10)

'params' => [
    'scoopit' =>
    [
        // Scoop.it API account base url here (suffixed with /api/1)
        'remoteUri' => 'https://acme-corp.scoop.it/api/1/',
        // Scoop.it Consumer Key/Secret (allows anonymous mode and mandatory for authenticated mode)
        'consumerKey' => '',
        'consumerSecret' => '',
        // URL root of local website instance, used for three-legged authententication callback
         'authorisationCallbackUri' => "path-to-website",
        // Scoop.it Consumer Key/Secret (mandatory for authenticated mode)
        'token' => '',
        'tokenSecret' => '',
    ],
],

The OAuth consumer key-secret combination can be obtained, after Scoop.it account login, on the Scoop.it Account Application Management Page, (*11)

Configuration of these details allow the client to interact with the remote Scoop.it account in the restricted anonymous mode, offering (partial) read-only access to the remote account., (*12)

To enable authenticated mode which provides maximal access to the remote account , a three-legged OAuth authentication procedure is followed., (*13)

For this, an appropriate value is set for the authorisationCallbackUri, which must be set to the root path of the local instance. For example, should the local instance deployment have routes defined as https://example.com/path/to/webapp/module/controller/view, then the authorisationCallbackUri is set to https://example.com/path/to/webapp/,, (*14)

Once configured, the process for obtaining token and token secret values can be described as followed, (*15)

Leg #1, (*16)

From commandline, run following command from the application root., (*17)

$ php yii scoopit/oauth

The system subsequently displays an external URL to the remote Scoop.it account, and prompts the user for a verifier.., (*18)

Leg #2, (*19)

To obtain the authorisation verfier, follow the external link in a graphical browser, authorising application access by the local application instance to the remote Scoop.it account. Upon authorisation, a redirection occurs to the local instance, using the authorisationCallbackUrl setup earlier, displaying a (temporary) token and the verifier requested by the prompt., (*20)

Leg #3, (*21)

Providing the verfier obtained in the previous leg in the prompt obtained in the first leg subsequently displays the token and token secret values, for local configuration setup, (*22)

For verification purposes, run following command after setup is complete., (*23)

$ php yii scoopit/test

The Versions