2017 © Pedro Peláez
 

library socialshare

Social share buttons, the easy way

image

vichaunter/socialshare

Social share buttons, the easy way

  • Tuesday, July 10, 2018
  • by vichaunter
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SocialShare 1.0-rc1

HitCount, (*1)

SocialShare enables developers to easily build social sharing buttons in their applications., (*2)

The main goal of SocialShare is to make as easy as possible adding share buttons for all social networks (and tools) in any website not depending on another packages., (*3)

Usage

SocialShare will provide a usage examples in short., (*4)

Anyway a simple way to use it is to call Buttons class with parameters as needed, or directly call each button:, (*5)

//remember to use class namespace
$shareButtons = new Buttons(); //this will create all disponible buttons
$shareButtons->setUrl($currentUrl); //pass your current url from your script

foreach($shareButtons as $button){
    echo $button->getHtml();
}

//result will be links to each social network with href and this format
//<a class="btn btn-social-icon btn-facebook" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyour.domain" target="_blank">Facebook</a>

You can pass two attributes when call Buttons, restriction to wich social networks you want to see, and iconPack if is defined. For the moment only fontAwesome., (*6)

$shareButtons = new Buttons(['facebook','twitter'], 'fontAwesome');
$shareButtons->setUrl($currentUrl); //pass your current url from your script

foreach($shareButtons as $button){
    echo $button->getHtml();
}

//this will result 
//<a class="btn btn-social-icon btn-facebook" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyour.domain" target="_blank"><i class="fa fa-facebook"></i></a>

Example usage with Nette Framework.

In any presenter just add this lines:, (*7)

$shareButtons = new Buttons(null, 'fontAwesome');
$shareButtons->setUrl($this->getHttpRequest()->getUrl()->absoluteUrl);
$this->template->shareButtons = $shareButtons->getAll();

Then in latte you can loop with:, (*8)

{ifset $shareButtons}
    {foreach $shareButtons as $shareButton}
        {$shareButton->getHtml()|noescape}
    {/foreach}
{/ifset}

Requirements

  • PHP 5.x+

Installation

To install SocialShare right now you can clone repositori in your project Github., (*9)

Versions Status

Version Status Repository Documentation PHP Version
1.x Maintenance socialshare socialshare >= 5.3

Questions, Help and Support?

For general questions (i.e, "how-to" questions), please left a message in Github issues tracker., (*10)

License

SocialShare PHP Library is released under the terms of MIT License., (*11)

For the full Copyright Notice and Disclaimer, see LICENSE., (*12)

The Versions

10/07 2018

dev-master

9999999-dev https://www.vichaunter.org

Social share buttons, the easy way

  Sources   Download

MIT

The Requires

  • php >=5.6

 

by Avatar vichaunter

social sharing buttons