PHP code example of webchemistry / social-share

1. Go to this page and download the library: Download webchemistry/social-share library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webchemistry / social-share example snippets


use WebChemistry\SocialShare\Provider\FacebookProvider;
use WebChemistry\SocialShare\Provider\LinkedInProvider;
use WebChemistry\SocialShare\SocialSharer;use WebChemistry\SocialShare\UrlToShare;

$sharer = new SocialSharer([
	new FacebookProvider(),
	new LinkedInProvider(),
]);

$sharer->share(new UrlToShare('https://example.com'));


use WebChemistry\SocialShare\SocialSharerInterface;
use WebChemistry\SocialShare\UrlToShare;

class Service {

	public function __construct(SocialSharerInterface $sharer) {
		$sharer->share(new UrlToShare('https://example.com'));
	}

}