nasirkhan/laravel-sharekit
Composer 安装命令:
composer require nasirkhan/laravel-sharekit
包简介
Reusable social sharing Blade components for Laravel with themeable styles, metadata auto-detection, and page-scoped assets.
关键字:
README 文档
README
Laravel Sharekit provides reusable Blade-powered social sharing buttons for Laravel applications.
It is designed to work well as a standalone package or alongside packages like nasirkhan/laravel-cube when you want social sharing on selected frontend pages without loading sharing assets globally.
Preview
Light Mode (Screenshot from Tailwind theme)
Dark Mode (Screenshot from Tailwind theme)
Features
- Blade component for grouped share buttons
- Metadata auto-detection from page meta tags and document data
- Per-instance prop overrides for URL, title, description, image, hashtags, and more
- Page-scoped CSS and JS loaded only when the component is rendered
- Native Web Share API support where available
- Popup-based sharing for common social networks
- Copy-link action with feedback state
- Configurable default theme, labels, enabled networks, popup size, and stack names
- Theme-ready structure with
defaultandtailwindpresets, with room for future themes
Requirements
- PHP ^8.3
- Laravel ^11.0 || ^12.0 || ^13.0
Installation
Install the package via Composer:
composer require nasirkhan/laravel-sharekit
The package uses Laravel package discovery, so no manual provider registration is needed.
Publish Configuration
If you want to customize defaults, publish the config file:
php artisan vendor:publish --tag=sharekit-config
If you want to override the package Blade views:
php artisan vendor:publish --tag=sharekit-views
Layout Requirements
Sharekit pushes page-scoped CSS and JS into Blade stacks.
Your layout should include:
@stack('after-styles')
inside the <head> section, and:
@stack('after-scripts')
before the closing </body> tag or in your layout footer.
These stack names are configurable in config/sharekit.php.
Basic Usage
Render the buttons with page metadata auto-detection:
<x-sharekit::buttons />
This is useful when your page already includes tags like:
og:urlog:titleog:descriptionog:imagetwitter:titletwitter:descriptiontwitter:imagelink[rel="canonical"]
Usage With Overrides
<x-sharekit::buttons :url="route('posts.show', $post)" :title="$post->name" :description="$post->intro" :image="$post->featured_image_url" :hashtags="['laravel', 'sharing']" :networks="['x', 'facebook', 'linkedin', 'copy', 'native']" />
Tailwind Example
<x-sharekit::buttons theme="tailwind" :url="route('posts.show', $post)" :title="$post->name" :description="$post->intro" :image="$post->featured_image_url" :networks="['x', 'facebook', 'linkedin', 'copy', 'native']" />
Available Props
<x-sharekit::buttons /> supports these main props:
urltitletextdescriptionimageviahashtagsnetworksthemelabelshow-labelsshow-headingsizepopupnative
Supported Networks
By default the package supports:
xfacebooklinkedinwhatsapptelegramredditemailcopynative
You can change the defaults in the config file or pass :networks="[...]" directly in the component.
Metadata Resolution
Sharekit resolves metadata in this order:
- Props passed directly to the component
- Page metadata detected in the browser from Open Graph, Twitter, canonical, and standard meta tags
- Server-side fallback values such as current URL and app name
This lets you drop the component into a page with good meta tags and get sensible share output with minimal configuration.
Themes
The package currently includes:
defaulttailwind
Theme mappings live in config/sharekit.php, so you can adjust classes or add future themes later without changing the package API.
Configuration
The config file includes options for:
- default theme
- Blade stack names
- popup dimensions
- whether native sharing is enabled when available
- default enabled networks
- label text
- theme class maps
Example:
'stack_names' => [ 'styles' => 'after-styles', 'scripts' => 'after-scripts', ],
Working With Laravel Cube
Laravel Sharekit works nicely with nasirkhan/laravel-cube.
A typical pattern is:
- use Cube for shared UI, layout, forms, navigation, and base frontend components
- use Sharekit only on content-detail pages such as posts, news items, events, or products
Example:
<x-cube::header-block :title="$post->name" /> <x-sharekit::buttons theme="tailwind" :url="route('posts.show', $post)" :title="$post->name" :description="$post->intro" :image="$post->featured_image_url" />
Testing
vendor/bin/phpunit
Suggested GitHub Topics
You can use these as GitHub repository topics/tags:
- laravel
- php
- blade-components
- social-share
- share-buttons
- sharing
- laravel-package
- reusable-components
- frontend
- web-share-api
- tailwindcss
- bootstrap
Composer Keywords Suggestion
Suggested package keywords:
- laravel
- sharing
- social-share
- social-sharing
- blade-components
- share-buttons
- share-links
- sharekit
- web-share-api
- frontend
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions, feedback, and suggestions are welcome.
Security
If you discover any security related issues, please email nasir8891@gmail.com instead of using the issue tracker.
Credits
License
The GNU General Public License v3.0 or later. Please see LICENSE for more information.
nasirkhan/laravel-sharekit 适用场景与选型建议
nasirkhan/laravel-sharekit 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 363 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「frontend」 「sharing」 「social-share」 「blade-components」 「social-sharing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nasirkhan/laravel-sharekit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nasirkhan/laravel-sharekit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nasirkhan/laravel-sharekit 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
Query filtering in your frontend
Silverstripe module handling meta tags for pages.
Article CSS-ID Frontend Output Optimization
Frontend support for the MultiColumnWizard
Symfony bundle that handles cross-origin resource sharing headers.
统计信息
- 总下载量: 363
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 43
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2026-04-07