astroanu/laravel-seo-gen
最新稳定版本:1.2.0
Composer 安装命令:
composer require astroanu/laravel-seo-gen
包简介
SEO friendly meta tags generator for Laravel
README 文档
README
SEO friendly meta tags generator for Laravel
Usage
add the provider to config\app.php:
'Astroanu\SEOGen\SEOGenProvider'
run php artisan vendor:publish to copy the config file.
'meta' => [
'default_title' => 'My App', // default title for application
'concat_default_title' => true, // wheatehr to concat the default title with the provided title. if this is true and if a title if provided in the controller the result would be "provided title : My App"
'concat_with' => ' : ' // the string to concat the titles
],
'social' => [
'og' => [
'render' => true, // wheather to render facebook og tags or not
'additional_og_tags' => [] // additinal tags to consider when rendering og tags
],
'twitter' => [
'render' => true // wheather to render twitter meta tags or not
]
]
In the base controller:
abstract class Controller extends BaseController {
protected $metaData;
public function __construct()
{
$this->metaData = new \Astroanu\SEOGen\Data();
}
}
in the controller set the tag attributes and pass them to the view:
$this->metaData->title = 'Welcome';
$this->metaData->description = 'Some demo text here for you to see';
$this->metaData->robots = 'noindex,nofollow';
$this->metaData->image = 'http://www.sample.com/image.jpg';
return view('welcome', ['metaData' => $this->metaData]);
in the view render everything:
<?php \Astroanu\SEOGen\Renderer::render($metaData); ?>
Example
// config
return array(
'meta' => [
'default_title' => 'My App',
'concat_default_title' => true,
'concat_with' => ' : '
],
'social' => [
'og' => [
'render' => true,
'additional_og_tags' => ['fb__app_id', 'test_tag']
],
'twitter' => [
'render' => true
]
]
);
// controller
$this->metaData->title = 'Welcome';
$this->metaData->description = 'Some demo text here for you to see';
$this->metaData->robots = 'noindex,nofollow';
$this->metaData->image = 'http://www.sample.com/image.jpg';
$this->metaData->fb__app_id = '456456456456'; // double underscore will be treated as a namespace
$this->metaData->test_tag = 'test text'; // this will still render as a meta tag
return view('welcome', ['metaData' => $this->metaData]);
will yeild:
<title>Welcome : My App</title>
<meta name="description" content="Some demo text here for you to see" />
<meta name="robots" content="noindex,nofollow" />
<meta name="image" content="http://www.sample.com/image.jpg" />
<meta property="og:title" content="Welcome" />
<meta property="og:description" content="Some demo text here for you to see" />
<meta property="og:image" content="http://www.sample.com/image.jpg" />
<meta property="fb:app_id" content="456456456456" />
<meta property="test_tag" content="test text" />
<meta property="twitter:title" content="Welcome" />
<meta property="twitter:description" content="Some demo text here for you to see" />
<meta property="twitter:image" content="http://www.sample.com/image.jpg" />
astroanu/laravel-seo-gen 适用场景与选型建议
astroanu/laravel-seo-gen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 944 次下载、GitHub Stars 达 8, 最近一次更新时间为 2015 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「html」 「seo」 「tags」 「laravel」 「meta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 astroanu/laravel-seo-gen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 astroanu/laravel-seo-gen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 astroanu/laravel-seo-gen 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
A powerfull cacher based on laravels file cache driver
Phalcon PHP Meta tags service
Help to manage meta data on Laravel Eloquent model
A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)
The tag extension for the yii framework
统计信息
- 总下载量: 944
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-08