Package Data | |
---|---|
Maintainer Username: | setkyar |
Maintainer Contact: | setkyar16@gmail.com (Set Kyar Wa Lar) |
Package Create Date: | 2016-11-19 |
Package Last Update: | 2016-11-23 |
Home Page: | https://packagist.org/packages/setkyar/laravel-customize-shares |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-09 15:08:34 |
Package Statistics | |
---|---|
Total Downloads: | 48 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Customize your social sharing icons easily. By Default, Package already include Facebook, Google+, LinkedIn, Twitter. But you can add more easily.
Pull package through Composer. Run
composer require setkyar/laravel-customize-shares
Add service provider within config/app.php
'providers' => [
SetKyar\CustomShares\CustomSharesProvider::class,
];
Run the following command for configuration
php artisan vendor:publish --provider="SetKyar\CustomShares\CustomSharesProvider" --tag="config"
Run the following command for views
php artisan vendor:publish --provider="SetKyar\CustomShares\CustomSharesProvider" --tag="views"
To customize your social icons add image with img tag. Customize like the following in config/shares-config.php
'facebook' => '<img src="your_custom_fb_icon_url" alt="Share to Faebook">'
or add social icon class like the following
'facebook' => '<i class="fa fa-facebook-official"></i>'
You can add one by one social share and can use collection as well.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
@include('share::facebook')
<br>
@include('share::twitter')
<br>
@include('share::gplus')
<br>
@include('share::linkedin')
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
@include('share::social_collection')
</body>
</html>
By default, Package already include Facebook, Google+, LinkedIn, Twitter. If you want to add more social media, add new on resources/views/vendor/customize-share
. You can learn easily by checking other social media. If you want to add default value on config, you can add on config/shares-config.php
By default, if user click on share. The share link will open in new full window. But if you want to made small new window like the following image
You have to add the following JavaScript code
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script>
var popupSize = {
width: 780,
height: 550
};
$(document).on('click', '.your-class > a', function(e){
var
verticalPos = Math.floor(($(window).width() - popupSize.width) / 2),
horisontalPos = Math.floor(($(window).height() - popupSize.height) / 2);
var popup = window.open($(this).prop('href'), 'social',
'width='+popupSize.width+',height='+popupSize.height+
',left='+verticalPos+',top='+horisontalPos+
',location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1');
if (popup) {
popup.focus();
e.preventDefault();
}
});
</script>
If you discover any security related issues, please email setkyar16@gmail.com com instead of using the issue tracker.