setkyar/laravel-social-share-cards

该软件包已被废弃,不再维护。未建议替代软件包。

简易社交卡片

1.1 2016-11-18 06:22 UTC

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 文章,使用 titledescriptionimage,您希望它们在 Facebook、Twitter 和 Google+ 上显示。

titledescriptionimage 必须填写!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 外观

Facebook Apperance

Twitter 外观

Twitter Apperance

Google+ 外观

Google+ Apperance

贡献

  1. 分叉它
  2. 创建您的功能分支(git checkout -b my-new-feature)
  3. 提交您的更改(git commit -am '添加了一些功能')
  4. 将分支推送到远程(git push origin my-new-feature)
  5. 创建新的 Pull Request

感谢