Login   Register  
PHP Classes
elePHPant
Icontem

File: README.md

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mike  >  PHP Socializer  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/plain
Description: Auxiliary data
Class: PHP Socializer
Embed social buttons and widgets in Web pages
Author: By
Last change: Update README.md
Date: 1 year ago
Size: 2,125 bytes
 

Contents

Class file image Download
PHP Socializer
----------

PHP module intended to make adding social sharing buttons more enjoyable.
Includes Google Analytics hooks to enable tracking of share activity.

Currently supports Twitter, Facebook, Google Plus, LinkedIn, StumbleUpon, GitHub and Flattr buttons.

Basic Example
-------------

![PHP Socializer Basic Example](http://pagesofinterest.net/images/github/coi-social/basic.png "PHP Socializer Basic Example")

These buttons can be created with the following code:

```php
<?php
use COI\Social;

include_once 'include.php'; // Contains constants
include_once 'require.php'; // Not necessary if you're using an autoloader

/* Somehere in your config */
 
// Create a manager for the Twitter, Google+ & LinkedIn button set
new Social\Manager(array(
    'twitter' => new Social\Twitter(array(
        'username' => 'pagesofinterest',
    )),
    'googleplus' => new Social\GooglePlus(array(
        'size' => 'medium'
    )),
    'linkedIn' => new Social\LinkedIn()
), array(
    'fadeIn' => 400
));
 
/* Where the buttons should be displayed */
echo $socialManager->render(array(
    // These options override those used in the manager initialisation above
    'url' => 'http://pagesofinterest.net/',
    'title' => 'Pages of Interest', 
));
 
/* In your footer, just above the closing <body> tag */
// Output the <script> with src pointing to the combined, compressed & cached JavaScript
echo COI\Social\Manager::combinedJavaScript();
?>
```

Single Button
-------------

![PHP Socializer Single Button](http://pagesofinterest.net/images/github/coi-social/watch.png "PHP Socializer Single Button")

To render a single button, use the following syntax:

```php
<?php
use COI\Social;

include_once 'include.php'; // Contains constants
include_once 'require.php'; // Not necessary if you're using an autoloader

// Render a single button
echo Social\GitHub(array(
    'user' => 'faceleg',
    'repository' => 'COI-Social',
    'type' => Social\GitHub\Type\WATCH
));
?>
```

Credits
-------

GitHub buttons created by Mark Dotto - [GitHub buttons](http://markdotto.github.com/github-buttons/ "GitHub Buttons").