Social

The module provides basic interface for publishing on Facebook, Twitter and LinkedIn. It lets to add posts and pictures on user wall and to photo gallery using API of social services.

LinkedIn

Configuration

To initialize Publish class you need configuration array dedicated for selected service.

LinkedIn configuartion array should have the following keys:

  • 'app_key'
  • 'app_secret'
  • 'access_token'

LinkedIn application should be set on the page https://developer.linkedin.com/. The 'app_key' value should be content of the field 'API Key' displayed in application details. As 'app_secret' value should be set content of the field 'Secret Key' displayed in application details.
The application should require the following LinkedIn user permissions: 'r_fullprofile', 'r_emailaddress', 'rw_nus'. User access token must be obtained after accepting these permissions by user.

Usage

Initialization

To use the module initialize Publish object for selected social service class with appropriate configuration array.

use Vegas\Social\LinkedIn\Publish;
$config = array(
    'app_key' => APP_ID,
    'app_secret' => APP_SECRET,
    'access_token' => USER_OAUTH_TOKEN
);

$publish = new Publish($config);

Preparing post

Publish interface contains a set of unified methods for post configuration.

$publish->setMessage("Post text")->setTitle("Post title")->setLink("http://amsterdamstandard.com/");

A photo can be set by URL:

$publish->setPhoto('http://www.toughzebra.com/wp-content/uploads/Amsterdam.Standard.Logo_.png');

Publishing post

The post or picture currently set in the Publish object can be sent on user page in social service by method post().

$publish->post();