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.



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

Twitter configuartion array should have the following keys:

  • 'consumer_key'
  • 'consumer_secret'
  • 'token'
  • 'secret'

Twitter application should be set on the page Cofiguration values should be set according to fields: 'Consumer Key', 'Consumer Secret', 'Access Token' and 'Access Token Secret' displayed in the tab "Keys and Access Tokens".
Your Twitter application must have set at least 'Read and Write' option in the tab 'Permissions'.



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

use Vegas\Social\Twitter\Publish;
$config = array(
    'consumer_key' => TWITTER_CONSUMER_KEY,
    'consumer_secret' => TWITTER_CONSUMER_SECRET,
    'token' => TWITTER_USER_TOKEN,
    'secret' => TWITTER_USER_SECRET

$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("");

A photo can be set by URL:


For Facebook and Twitter photo can be set also by CURL:
$curl_file = curl_file_create(dirname(__DIR__) . '/test_picture.png', 'image/png', 'Test message ' . rand());

Publishing post

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