setkyar / laravel-social-share-cards
该软件包已被废弃,不再维护。未建议替代软件包。
简易社交卡片
1.1
2016-11-18 06:22 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0
This package is auto-updated.
Last update: 2023-01-20 10:21:30 UTC
README
安装
首先,通过 Composer 引入软件包。
composer require setkyar/laravel-social-share-cards
然后,如果使用 Laravel 5,在 config/app.php
中包含服务提供者。
'providers' => [
SetKyar\Social\SocialServiceProvider::class,
];
运行 php artisan vendor:publish
获取 Laravel 社交分享配置。
使用
在 social.php
配置文件中设置 FB 应用 ID 和您网站的 Twitter 账户。(这些是可选的)
fb_app_id
twitter_site
在 head 标签中包含 meta 文章,使用 title
、description
和 image
,您希望它们在 Facebook、Twitter 和 Google+ 上显示。
title
、description
和image
必须填写!author
是可选的!
@include('social::meta-article', [
'title' => 'Hello World',
'description' => 'Welcome from Hello World',
'image' => 'http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg',
'author' => 'Set Kyar Wa Lar'
])
示例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
@include('social::meta-article', [
'title' => 'Hello World',
'description' => 'Welcome from Hello World',
'image' => 'http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg',
'author' => 'Set Kyar Wa Lar'
])
<title>Document</title>
</head>
<body>
</body>
</html>
示例外观
Facebook 外观
Twitter 外观
Google+ 外观
贡献
- 分叉它
- 创建您的功能分支(git checkout -b my-new-feature)
- 提交您的更改(git commit -am '添加了一些功能')
- 将分支推送到远程(git push origin my-new-feature)
- 创建新的 Pull Request
感谢
- 感谢 Jeffrey Way 的 laracast flash,POVILAS KOROP 的 本教程 以及 Philip Brown 的 本教程 :)