2017 © Pedro Peláez
 

cakephp-plugin cakephp-social-share

CakePHP helper for creating social share/bookmark links

image

drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  • Thursday, February 8, 2018
  • by drmonkeyninja
  • Repository
  • 7 Watchers
  • 26 Stars
  • 56,977 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 10 Forks
  • 1 Open issues
  • 19 Versions
  • 4 % Grown

The README.md

CakePHP Social Share

Latest Stable Version License Build Status Total Downloads, (*1)

This plugin provides a CakePHP View helper for creating links to share content on numerous social networks and bookmarking sites., (*2)

The aim of the plugin is to keep things simple. It doesn't come packaged with any JavaScript and I leave design decisions up to you. You can choose whether you want to use text, images, sprites or an icon font for your links., (*3)

Social Share currently supports Delicious, Digg, Evernote, Facebook, Friend Feed, Google Bookmarks, Google+, LinkedIn, Newsvine, Pinterest, Pocket, Reddit Slashdot, simple email, StumbleUpon, Technorati, Tumblr, Twitter and WhatsApp., (*4)

Note: This branch is for CakePHP 4.x., (*5)

Installation

Install using composer: composer require drmonkeyninja/cakephp-social-share:4.*, (*6)

Then add the following line to your Application.php file to load the plugin., (*7)

$this->addPlugin(\SocialShare\Plugin::class);

Also don't forget to add the helper in your AppView:-, (*8)

$this->loadHelper('SocialShare.SocialShare');

Usage

SocialShareHelper::link(string $service, string $title, mixed $url = null, array $options = [])

Returns an HTML link to share the current page for the supplied service. For example to create a link for Facebook:-, (*9)

echo $this->SocialShare->link(
    'facebook',
    __('Share on Facebook')
);

You can easily produce a list of links to share to different social networks:-, (*10)

$services = [
    'facebook' => __('Share on Facebook'),
    'gplus' => __('Share on Google+'),
    'linkedin' => __('Share on LinkedIn'),
    'twitter' => __('Share on Twitter')
];

echo '

    '; foreach ($services as $service => $linkText) { echo '
  • ' . $this->SocialShare->link( $service, $linkText ) . '
  • '; } echo '
';

Supported services:-, (*11)

  • delicious
  • digg
  • email
  • evernote
  • facebook
  • friendfeed
  • google (Google Bookmarks)
  • gplus (Google+)
  • linkedin
  • newsvine
  • pinterest
  • pocket
  • reddit
  • slashdot
  • stumbleupon
  • technorati
  • tumblr
  • twitter
  • whatsapp

You can pass a URL or a routing array as the third parameter for the URL you want to share., (*12)

$options supports the same options as HtmlHelper::link() as well as a 'text' option for a page title you want to include when sharing the URL. For Pinterest there is an additional 'image' option for a URL to an image to share., (*13)

SocialShareHelper::href()

SocialShareHelper::href(string $service, mixed $url = null, array $options = [])

Returns an URL for sharing to the supplied service., (*14)

SocialShareHelper::fa()

SocialShareHelper::fa(string $service, mixed $url = null, array $options = [])

Returns an HTML link just like SocialShare::link() except the link text will be a relevant Font Awesome icon for the service., (*15)

For example:-, (*16)

echo $this->SocialShare->fa(
    'facebook',
    'http://example.com'
);

Will output:-, (*17)

<a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fexample.com">
    <i class="fa fa-facebook"></i>
</a>

If you need to change the icon markup output by fa() you can override the icon class using icon_class:-, (*18)

echo $this->SocialShare->fa(
    'facebook',
    null,
    ['icon_class' => 'fa fa-facebook-square']
);

The Versions

08/02 2018

dev-master

9999999-dev https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

08/02 2018

3.1.0

3.1.0.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

08/02 2018

dev-feature/social-share-url-lib

dev-feature/social-share-url-lib https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

01/02 2018

dev-update-travis

dev-update-travis https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

14/01 2017

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

12/07 2016

3.0.2

3.0.2.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

12/07 2016

2.0.4.1

2.0.4.1 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

17/02 2016

3.0.1

3.0.1.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

18/05 2015

3.0.0.1

3.0.0.1 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

08/05 2015

3.0.0.0

3.0.0.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

08/05 2015

2.0.4.0

2.0.4.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

08/05 2015

3.x-dev

3.9999999.9999999.9999999-dev https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

 

cakephp helper

30/04 2015

2.0.3.0

2.0.3.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

24/03 2015

2.0.2.2

2.0.2.2 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

23/03 2015

2.0.2.1

2.0.2.1 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

23/03 2015

dev-dev

dev-dev https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

04/03 2015

2.0.2.0

2.0.2.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

02/03 2015

2.0.1.0

2.0.1.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper

01/03 2015

2.0.0.0

2.0.0.0 https://github.com/drmonkeyninja/cakephp-social-share

CakePHP helper for creating social share/bookmark links

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cakephp helper