PHPackages                             zyan/laravel-sitemap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zyan/laravel-sitemap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zyan/laravel-sitemap
====================

laravel-sitemap生成器

1.0.2(3y ago)08.0kMITPHP

Since Oct 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aa24615/laravel-sitemap)[ Packagist](https://packagist.org/packages/zyan/laravel-sitemap)[ RSS](/packages/zyan-laravel-sitemap/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (4)Used By (0)

zyan/laravel-sitemap
====================

[](#zyanlaravel-sitemap)

laravel框架 sitemap快速生成

要求
--

[](#要求)

1. php &gt;= 7.2
2. Composer

安装
--

[](#安装)

```
composer require zyan/laravel-sitemap -vvv
```

使用
--

[](#使用)

```
use Zyan\Sitemap\Sitemap;

//path输出目录 不传默认为 public目录
$path = public_path();

$sitemap = Factory::sitemap($path);
$sitemap->table('表名')->where(['where条件 可不传'])->field(['字段'])->url('url规则')->make();

//可生成多个表
$sitemap->table('表名')->url('url规则')->make();
```

table

```
//不需要填写前缀
$sitemap->table('article')->make();
```

where\[可选\]

```
//请参考laravel手册中where传数组的方法 https://learnku.com/docs/laravel/8.5/queries/10404#ead379
$sitemap->table('article')->where([['id','>',1000],['state','=',1]])->make();
```

field

```
//请参考laravel手册select传数组的方法 https://learnku.com/docs/laravel/8.5/queries/10404#bb14ff
$sitemap->table('article')->field(['id','...'])->make();
```

url

```
//配合field字段为变量替换url 请用{}括起来
$sitemap->table('article')->field(['id'])->url('/article/{uid}.html')->make();
//可以有多个
$sitemap->table('article')->field(['id','type'])->url('/article/{type}/{uid}.html')->make();
//也可以指定域名 不指定默认以 读取 config('app.url')
$sitemap->table('article')->field(['id','type'])->url('http://www.php.net/article/{id}.html')->make();
```

make

```
//开始生成
$sitemap->table('article')->field(['id'])->url('/user/{id}.html')->make();
```

生成结果
----

[](#生成结果)

暂时仅支持txt格式 /sitemap/map.txt 为索引文件对应下面的url 请将这里的网址添加到百度站长即可

```
http://www.php.net/sitemap/article_1.txt
http://www.php.net/sitemap/article_2.txt
http://www.php.net/sitemap/article_3.txt
...
```

/sitemap/表名\_分页.txt
/sitemap/article\_1.txt
/sitemap/article\_2.txt
/sitemap/article\_3.txt

> 以上是默认目录的生成结果,如果您指定了目录,请自行修改上传后对应该路径

参与贡献
----

[](#参与贡献)

1. fork 当前库到你的名下
2. 在你的本地修改完成审阅过后提交到你的仓库
3. 提交 PR 并描述你的修改，等待合并

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

1355d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33275679?v=4)[读心印](/maintainers/aa24615)[@aa24615](https://github.com/aa24615)

---

Top Contributors

[![aa24615](https://avatars.githubusercontent.com/u/33275679?v=4)](https://github.com/aa24615 "aa24615 (3 commits)")

---

Tags

laravelSitemap

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zyan-laravel-sitemap/health.svg)

```
[![Health](https://phpackages.com/badges/zyan-laravel-sitemap/health.svg)](https://phpackages.com/packages/zyan-laravel-sitemap)
```

###  Alternatives

[fomvasss/laravel-meta-tags

A package to manage SEO (meta-tags, xml-fields, etc.)

3129.8k](/packages/fomvasss-laravel-meta-tags)[calotype/seo

A package containing SEO helpers.

742.6k](/packages/calotype-seo)[3x1io/filament-sitemap

Site Settings Like title, description, profile and Sitemap Generator

152.2k](/packages/3x1io-filament-sitemap)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
