yiimaker / yii2-social-share
社交网络分享扩展
v2.3.4
2024-08-29 22:06 UTC
Requires
- php: >=5.6.0
- yiisoft/yii2: ^2.0.13
Requires (Dev)
- codeception/codeception: ~4.1
- codeception/module-asserts: ^1.3
- codeception/module-yii2: ^1.1
- friendsofphp/php-cs-fixer: ^2.18
README
社交网络分享扩展
使用此扩展,您可以将网页中的数据分享到任何社交网络!功能:SEO支持、默认社交网络图标、轻松创建其他社交网络的定制驱动程序等!
文档位于 docs/guide/README.md。
扩展自带以下社交网络驱动程序
即时通讯驱动程序
以及其他驱动程序
您还可以 创建 您自己的驱动程序,非常简单!
安装
安装此扩展的首选方式是通过 composer。
运行
$ composer require yiimaker/yii2-social-share
或者将以下内容添加到您的 composer.json
文件的 require
部分中
"yiimaker/yii2-social-share": "~2.3"
使用
在配置文件中配置社交网络
'components' => [ // ... 'socialShare' => [ 'class' => \ymaker\social\share\configurators\Configurator::class, 'socialNetworks' => [ 'facebook' => [ 'class' => \ymaker\social\share\drivers\Facebook::class, ], ], ], ],
然后在视图文件中调用小部件
<?= \ymaker\social\share\widgets\SocialShare::widget([ 'configurator' => 'socialShare', 'url' => \yii\helpers\Url::to('absolute/route/to/page', true), 'title' => 'Title of the page', 'description' => 'Description of the page...', 'imageUrl' => \yii\helpers\Url::to('absolute/route/to/image.png', true), ]); ?>
测试
您可以使用 composer 命令或以下命令运行测试
$ composer tests
$ ./vendor/bin/codecept build && ./vendor/bin/codecept run
贡献
有关贡献的信息,请阅读 CONTRIBUTING.md。
赞助
许可证
本项目在 BSD-3-Clause 许可证的条款下发布 license。
版权所有 (c) 2017-2021, Volodymyr Kupriienko