[英]laravel 5.4 sitemap error
I want to install this package in my project https://github.com/spatie/laravel-sitemap 我想在我的项目中安装此软件包https://github.com/spatie/laravel-sitemap
but the installation's failed. 但安装失败。 the error is
错误是
Anyone encountered this error. 任何人都遇到此错误。 or their have other better package for laravel sitemap?
还是他们有用于laravel网站地图的其他更好的软件包? any tutorial?
任何教程? thanks everyone :)
感谢大家 :)
The error message is pretty clear. 错误消息很清楚。 You're trying to install
spatie/laravel-sitemap:^3.3
, which requires laravel/framework:5.5
or higher. 您正在尝试安装
spatie/laravel-sitemap:^3.3
,需要laravel/framework:5.5
或更高版本。 So you need to either upgrade to use Laravel 5.5, or use an older version of spatie/laravel-sitemap
. 因此,您需要升级以使用Laravel 5.5,或使用旧版本的
spatie/laravel-sitemap
。
The Github repository lists the available releases . Github存储库列出了可用的发行版 。 I would suggest looking at
v2.4
as a starting point, as the ChangeLog for v3.0
mentions about adding Laravel 5.5 support. 我建议您以
v2.4
为起点,因为v3.0
的ChangeLog提到了添加Laravel 5.5支持。
composer require spatie/laravel-sitemap:2.4
Edit : 编辑 :
You asked where to put the generator code. 您询问将生成器代码放在何处。 It isn't something you're going to want to run on every request, so I would suggest creating a route dedicated to creating the sitemap.
您并不是要在每个请求上都运行它,所以我建议创建一条专门用于创建站点地图的路线。
// routes/web.php
Route::get('sitemap/generate', function () {
SitemapGenerator::create(base_url())->writeToFile($path);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.