PHPackages                             adnan0703/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. adnan0703/sitemap

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

adnan0703/sitemap
=================

Sitemap plugin for CakePHP

2.0(9y ago)2451MITPHPPHP &gt;=5.4

Since Apr 2Pushed 9y ago3 watchersCompare

[ Source](https://github.com/Adnan0703/sitemap)[ Packagist](https://packagist.org/packages/adnan0703/sitemap)[ Docs](https://github.com/Adnan0703/sitemap)[ RSS](/packages/adnan0703-sitemap/feed)WikiDiscussions master Synced 1mo ago

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

Sitemap plugin for CakePHP
==========================

[](#sitemap-plugin-for-cakephp)

[![Build Status](https://camo.githubusercontent.com/8e2da7b7baa7830b4f4a7acc5451096041521b507d1b81d5a1b3ece26f0a10a1/68747470733a2f2f7472617669732d63692e6f72672f41646e616e303730332f736974656d61702e737667)](https://travis-ci.org/Adnan0703/sitemap)[![Coverage Status](https://camo.githubusercontent.com/d2dd2dc1a9d130891b3107706b0bd2c451b25c045ca9fcae2f784513ca8b0fb2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f41646e616e303730332f736974656d61702f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/Adnan0703/sitemap?branch=master)

The **Sitemap** plugin is a CakePHP wrapper around [Cartographer](http://github.com/tackk/cartographer/) library. It makes it very easy to generate sitemap. The **Sitemap** plugin can handle Sitemaps of more than 50,000 entries. Also it iterates over table records instead of retrieving all records at once.

Requirements
------------

[](#requirements)

- PHP 5.4+
- CakePHP 3.0
- Cartographer Library (included as composer dependency)

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

```
composer require adnan0703/Sitemap

```

How to use it
-------------

[](#how-to-use-it)

For example if you want to generate sitemap of Posts model, you need to define `sitemapQuery` method in Posts table class and `sitemapEntry` virtual property in entity class of Posts model. The `sitemapQuery` method must return `Query` object and `sitemapEntry` must be an `array` containing at least `url` key.

With `sitemapQuery` method you can control records that will be added to sitemap and with `sitemapEntry` virtual property you can control properties of sitemap entry.

```
// in Posts table class
public function sitemapQuery()
{
	return $this->find()
		->select(['id', 'name'])
		->where(['published' => true]);
}
```

```
// in Posts entity class
protected function _getSitemapEntry()
{
	return [
		'url' => $url, // required
		'changefreq' => 'weekly', // optional
		'priority' => '0.8', // optional
	];
}
```

Now we can generate sitemap of Posts model as shown in code below.

```
set_time_limit(60*10); // if you have lots of records
$models = ['Posts'];
$dirPath = WWW_ROOT . DS . 'sitemaps';
$sitemap = new \Adnan0703\Sitemap\Lib\Sitemap();
$mainSitemap = $sitemap->createSitemap(
	$dirPath,
	'http://example.com/sitemaps/',
	$models,
	true
);
// $mainSitemap will be 'http://example.com/sitemaps/sitemap.xml'
```

You can also add Pages controller urls and other urls in sitemap.

```
Configure::write('Sitemap.pages', [
	[
		'url' => Router::url(['controller' => 'Pages', 'action' => 'home'], true),
		'priority' => '0.9',
		'changefreq' => 'daily'
	],
	[
		'url' => Router::url(['controller' => 'Pages', 'action' => 'about_us'], true),
		'priority' => '0.9',
		'changefreq' => 'daily'
	],
]);
```

Configuration Options
---------------------

[](#configuration-options)

**Sitemap** plugin has two configuration options. `Sitemap.pages` and `Sitemap.findLimit`. `Sitemap.pages` option has been explained above. With `Sitemap.findLimit` you can limit the number of records **Sitemap** retrieves at a time while iterating over table.

```
Configure::write('Sitemap.findLimit', 600);
```

Support
-------

[](#support)

For bugs and feature requests, please use the [issues](https://github.com/adnan0703/Sitemap/issues) section of this repository.

Contributing to this Plugin
---------------------------

[](#contributing-to-this-plugin)

Please feel free to contribute to the plugin with new issues, requests, unit tests and code fixes or new features.

License
-------

[](#license)

Copyright 2015, Adnan Aslam

Licensed under The MIT License Redistributions of files must retain the above copyright notice.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~277 days

Total

2

Last Release

3421d ago

Major Versions

1.0 → 2.02017-01-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e2c6785b90dd3be756bc89d2ce78057ebba40971c03a9e782408512b2d4e94b?d=identicon)[adnan0703](/maintainers/adnan0703)

---

Top Contributors

[![Adnan0703](https://avatars.githubusercontent.com/u/6469288?v=4)](https://github.com/Adnan0703 "Adnan0703 (43 commits)")

---

Tags

cakephpSitemap

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[dereuromark/cakephp-shim

A CakePHP plugin to shim applications between major framework versions.

401.0M11](/packages/dereuromark-cakephp-shim)[cakedc/tiny-mce

TinyMCE Plugin for CakePHP

10790.2k](/packages/cakedc-tiny-mce)[loadsys/cakephp_sitemap

A CakePHP Plugin for adding automatic XML and HTML Sitemaps to an app

2819.6k](/packages/loadsys-cakephp-sitemap)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)

PHPackages © 2026

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