chengkangzai / laravel-social-share-links
A laravel pacakge that generate social share link, thats all it does
Installs: 3 266
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^8.1
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-08 10:07:47 UTC
README
Installation
You can install the package via composer:
composer require chengkangzai/laravel-social-share-links
Usage
Generate social share link for Single Social Media
use Chengkangzai\LaravelSocialShareLinks\Enums\SocialMediaType; use Chengkangzai\LaravelSocialShareLinks\SocialShareLinksBuilder; $builder = new SocialShareLinksBuilder(); $link = $builder->url($url) // $url is optional, if not passed, it will use the current url ->facebook() ->build(); $facebookLink = $link[SocialMediaType::Facebook];
If you prefer to call it statically
use Chengkangzai\LaravelSocialShareLinks\Enums\SocialMediaType; use Chengkangzai\LaravelSocialShareLinks\SocialShareLinksBuilder; $link = SocialShareLinksBuilder::make($url) // $url is optional, if not passed, it will use the current url ->facebook() ->build(); $facebookLink = $link[SocialMediaType::Facebook];
Generate social share links for Multiple Social Media
use Chengkangzai\LaravelSocialShareLinks\Enums\SocialMediaType; use Chengkangzai\LaravelSocialShareLinks\SocialShareLinksBuilder; $builder = new SocialShareLinksBuilder(); $link = $builder->url($url) ->twitter() ->text('Hello World') ->hashtags(['laravel', 'social', 'share', 'links']) ->via('chengkangzai') ->build(); $twitterLink = $link[SocialMediaType::Twitter];
Generate social share links for multiple social media with for
method
use Chengkangzai\LaravelSocialShareLinks\Enums\SocialMediaType; use Chengkangzai\LaravelSocialShareLinks\SocialShareLinksBuilder; $builder = new SocialShareLinksBuilder(); $links = $builder->url($url) ->for([ SocialMediaType::Facebook, SocialMediaType::Twitter, ]) ->build(); $facebookLink = $links[SocialMediaType::Facebook]; $twitterLink = $links[SocialMediaType::Twitter];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.