rivalex/laravel-humanstxt

为 Laravel 10 简单的 humans.txt 路由和视图

v11.0 2024-04-11 10:52 UTC

This package is auto-updated.

Last update: 2024-09-11 11:44:03 UTC


README

Latest Version on Packagist Software License

laravel-humanstxt

感谢 Marcus Olsson 提供这个出色的解决方案Marcus Olsson

停止在你的客户页脚添加“由我的机构制作,所以我在页脚放了一个便宜的链接”的链接——那个页脚是你的客户的财产。相反,如果你想得到认可——添加一个简单的 humans.txt。

这个包所做的只是添加一个 /humans.txt 路由和相关视图。你可能会问,“我为什么要为这样简单的事情使用包?” 我也是这样想的,直到我做过20-30次——它只是节省了几分钟,但时间久了就积累起来了。

版本兼容性

请参阅COMPATABILITY.md以获取完整的兼容性图表。否则,Composer 应该能够自行解决。

安装

通过 composer 安装

$ composer require rivalex/laravel-humanstxt

由于 Laravel > 5.5,服务提供程序将被自动添加。您也可以手动将服务提供程序添加到您的 app.php

'providers' => [
    Rivalex\Humans\ServiceProvider::class
]

发布视图

$ php artisan vendor:publish --provider="Rivalex\Humans\ServiceProvider"

或者只需输入

$ php artisan vendor:publish

然后选择 Rivalex\Humans\ServiceProvider

个性化定制

视图位于您的视图文件夹中 /humans/humans.blade.php

也可以将其放在您的 <head>

<link type="text/plain" rel="author" href="http://domain.com/humans.txt" />

如果您偶然需要通过命名路由访问您的 humans.txt,这也是可能的

<link type="text/plain" rel="author" href="{{ route('humans.txt') }}" />

了解更多

humanstxt.org了解关于 humans.txt 标准的更多信息。

测试

$ composer test

$ phpunit

许可证

MIT 许可证(MIT)。有关更多信息,请参阅许可证文件

© 2021 Marcus Olsson