The SocialMedia plugin provides the tools to generate social media links (Helper) and handle them (Controller).
- CakePHP 2.9.0 or greater.
- PHP 7.0.0 or greater.
- Clone/Copy the files in this directory into
app/Plugin/SocialMedia
- Ensure the plugin is loaded in
app/Config/bootstrap.php
by calling:
CakePlugin::load('SocialMedia');
- Ensure to configure the following two lines in
app/Config/bootstrap.php
:
Configure::write('SocialMedia.salt', 'your-salt');
Configure::write('SocialMedia.facebookAppId', 'your-facebook-app-id');
echo $this->SocialMedia->facebook(
__('Share on Facebook'), [
'link' => 'your-url',
'name' => 'your-name',
'caption' => 'your-caption',
'description' => 'your-description',
'picture' => 'your-picture'
]
);
echo $this->SocialMedia->twitter(
__('Tweet on Twitter'), [
'url' => 'your-url',
'via' => 'your-via',
'text' => 'your-text',
]
);