PHPackages                             premento/googlenewssitemap - 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. premento/googlenewssitemap

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

premento/googlenewssitemap
==========================

Easy way to do sitemap for google news

1.0.0(1y ago)05MITPHPPHP &gt;=7.0.0

Since Dec 28Pushed 1y agoCompare

[ Source](https://github.com/premento/googlenewssitemap)[ Packagist](https://packagist.org/packages/premento/googlenewssitemap)[ Docs](https://github.com/premento/googlenewssitemap)[ RSS](/packages/premento-googlenewssitemap/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Google News Sitemap
===================

[](#google-news-sitemap)

[![Packagist](https://camo.githubusercontent.com/00e68cbc7212c014e38021f94a616ae25f8cc2df6bb1aa67afe5ee2cbdfbf8fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7072656d656e746f2f676f6f676c656e657773736974656d61702e737667)](https://packagist.org/packages/premento/googlenewssitemap)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/cf9ac7ec628f080011ef66457784aac7fa5cb840038a617c14672c5af9bfd3c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7072656d656e746f2f676f6f676c656e657773736974656d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/premento/googlenewssitemap)

Class for generating the sitemap for google news. More about google news sitemap [here](https://support.google.com/news/publisher/answer/74288?hl=uk)

Example of the sitemap from google

```

   http://www.example.org/business/article55.html

       The Example Times
       en

     PressRelease, Blog
     2008-12-23
     Companies A, B in Merger Talks
     business, merger, acquisition, A, B
     NASDAQ:A, NASDAQ:B

      https://example.com/image.jpg

      https://example.com/photo.jpg

```

Install
-------

[](#install)

Via Composer

```
$ composer require premento/googlenewssitemap
```

Usage
-----

[](#usage)

```
$sitemap = new \Premento\SitemapGoogle\Sitemap($pathToFile);
$siteName = "example.com";
foreach ($posts as $item) {
    $sitemap->setGenres("Blog");
    $sitemap->setKeywords($item['tags']);
    $sitemap->setLanguage("en");
    $sitemap->setLoc($item['url']);
    $sitemap->setName($siteName);
    $sitemap->setPublicationDate($item['publishAt']->getTimestamp());
    $sitemap->setTitle($item['title']);
    $sitemap->setImages($item['images']);
    $sitemap->addItem();
}
$sitemap->write();
```

`$posts` - list of news

`$pathToFile` - where the file should apear. For example `getcwd() . '/public' . '/sitemap_google_news.xml'`

`$item['date']` - should be DateTime

Tags and genres could be empty.

Credits
-------

[](#credits)

- [Dan Kurasov](https://github.com/dionisiy13)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 57.1% 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

Unknown

Total

1

Last Release

553d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15952736?v=4)[Premento](/maintainers/premento)[@premento](https://github.com/premento)

---

Top Contributors

[![premento](https://avatars.githubusercontent.com/u/15952736?v=4)](https://github.com/premento "premento (4 commits)")[![dionisiy13](https://avatars.githubusercontent.com/u/13090143?v=4)](https://github.com/dionisiy13 "dionisiy13 (3 commits)")

---

Tags

phpSitemapgoogle-news

### Embed Badge

![Health badge](/badges/premento-googlenewssitemap/health.svg)

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

###  Alternatives

[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

37460.0k16](/packages/ultrono-laravel-sitemap)

PHPackages © 2026

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