cybercog/robots-txt
Composer 安装命令:
composer require cybercog/robots-txt
包简介
Robots.txt Generator
关键字:
README 文档
README
RobotsTxt is a package to dynamically create robots.txt files. It's made to work with Laravel and native PHP.
Checkout the RobotsTxt.php class for a full understanding of the functionality.
This is fork of Robots package
Installation
Downloading
As usual with Composer packages, there are two ways to install:
You can install via Composer. Pick the "master" as the version of the package.
composer require cybercog/robots-txt
Or add the following to your composer.json in the require section and then run composer update to install it.
{ "require": { "cybercog/robots-txt": "^1.0" } }
Usage
Laravel
Once installed via Composer you need to add the service provider. Do this by adding the following to the 'providers' section of the application config (usually app/config/app.php):
Cog\RobotsTxt\Providers\RobotsTxtServiceProvider::class,
The quickest way to use Robots is to just setup a callback-style route for robots.txt in your /app/routes.php file.
<?php Route::get('robots.txt', function() { // If on the live server, serve a nice, welcoming robots.txt. if (App::environment() == 'production') { RobotsTxt::addUserAgent('*'); RobotsTxt::addSitemap('sitemap.xml'); } else { // If you're on any other server, tell everyone to go away. RobotsTxt::addDisallow('*'); } return Response::make(RobotsTxt::generate(), 200, array('Content-Type' => 'text/plain')); });
Native PHP
Add a rule in your .htaccess for robots.txt that points to a new script/template/controller/route/etc.
The code would look something like:
<?php use Cog\RobotsTxt\RobotsTxt; $robotsTxt = new RobotsTxt(); $robotsTxt->addUserAgent('*'); $robotsTxt->addSitemap('sitemap.xml'); header("HTTP/1.1 200 OK"); echo $robotsTxt->generate();
And that's it! You can show different robots.txt files depending on how simple or complicated you want it to be.
Contributing
Please refer to CONTRIBUTING.md for information on how to contribute to RobotsTxt and its related projects.
License
The RobotsTxt library is an open-sourced software licensed under the MIT.
cybercog/robots-txt 适用场景与选型建议
cybercog/robots-txt 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.4k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「seo」 「robots.txt」 「robots」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cybercog/robots-txt 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cybercog/robots-txt 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cybercog/robots-txt 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Help to manage meta data on Laravel Eloquent model
Statamic Fine Seo addon
A route for serving a basic robots.txt in Laravel 5.1+, based on configuration settings.
Agnostic model to efficiently query and scroll any kind of data (SQL, Search engine, HTTP API, CSV, ...) and push them anywhere with a ETL
Laravel 5.x helpers for a semi-automated robots.txt and meta tags
统计信息
- 总下载量: 2.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-07-04