orzcc/autometa
Composer 安装命令:
composer require orzcc/autometa
包简介
A Meta Tool for Laravel
README 文档
README
AutoMeta is a package for Laravel 5 that provides helpers for some common SEO techniques.
Fix some bugs and make code simple of artesaos/seotools.
Installation
1 - Dependency
The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:
composer require orzcc/autometa
2 - Provider
You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your config/app.php file adding the following code at the end of your 'providers' section:
config/app.php
// file START ommited 'providers' => [ // other providers ommited 'Orzcc\AutoMeta\Providers\AutoMetaServiceProvider', ], // file END ommited
3 - Facade
In order to use the Meta facade, you need to register it on the config/app.php file, you can do that the following way:
// file START ommited 'aliases' => [ // other Facades ommited 'Meta' => 'Orzcc\AutoMeta\Facades\AutoMeta', ], // file END ommited
4 - Usage
Meta tags Generator
With Meta you can create meta tags to the head
In your controller
use Meta; class CommomController extends Controller { /** * @return \Illuminate\View\View */ public function index() { Meta::setTitle('Home'); Meta::setDescription('This is my page description'); $posts = Post::all(); return view('myindex', compact('posts')); } /** * @return \Illuminate\View\View */ public function show($id) { $post = Post::find($id); Meta::setTitle($post->title); Meta::setDescription($post->resume); Meta::addMeta('article:published_time', $post->published_date->toW3CString(), 'property'); Meta::addMeta('article:section', $post->category, 'property'); Meta::addKeyword(['key1', 'key2', 'key3']); return view('myshow', compact('post')); } }
In Your View
<html> <head> {!! Meta::generate() !!} </head> <body> </body> </html>
<html> <head> <title>Title - SubTitle</title> <meta name='description' itemprop='description' content='description...' /> <meta name='keywords' content='key1, key2, key3' /> <meta property='article:published_time' content='2015-01-31T20:30:11-02:00' /> <meta property='article:section' content='news' /> </head> <body> </body> </html>
Configuration
In autometa.php configuration file you can determine the properties of the default values and some behaviors.
- defaults - What values are displayed if not specified any value for the page display. If the value is
false, nothing is displayed. - webmaster - Are the settings of tags values for major webmaster tools. If you are
nullnothing is displayed.
API (Meta)
Meta::setTitleSeperator($seperator); Meta::generate::setTitle($title); Meta::setDescription($description); Meta::setKeywords($keywords); Meta::addKeyword($keyword); Meta::addMeta($meta, $value = null, $name = 'name'); // You can concatenate methods Meta::setTitle($title) ->setDescription($description) ->setKeywords($keywords) ->addKeyword($keyword) ->addMeta($meta, $value); // Retrieving data Meta::getTitle(); Meta::getTitleSession(); Meta::getTitleSeperator(); Meta::getKeywords(); Meta::getDescription(); Meta::reset(); Meta::generate();
Sponsor
orzcc/autometa 适用场景与选型建议
orzcc/autometa 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.46k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「seo」 「meta」 「laravel5」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 orzcc/autometa 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 orzcc/autometa 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 orzcc/autometa 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Harvest statistics and meta data from an URL or his source code (seo oriented).
Phalcon PHP Meta tags service
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content (forked from Cyber-Duck/Silverstripe-SEO)
Help to manage meta data on Laravel Eloquent model
Laravel helpers for dev
统计信息
- 总下载量: 8.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-27