2017 © Pedro Peláez
 

library silex-sitemap-service-provider

Simple service provider to generate a xml-sitemap.

image

tm/silex-sitemap-service-provider

Simple service provider to generate a xml-sitemap.

  • Thursday, February 23, 2017
  • by tommymuehle
  • Repository
  • 2 Watchers
  • 3 Stars
  • 6,390 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 8 Versions
  • 5 % Grown

The README.md

silex-sitemap-service-provider

Build Status Latest Stable Version License Issues Total Downloads, (*1)

The provider supports both major Versions of Silex., (*2)

Installation

For applications based on Silex >= 2.0.0:, (*3)

composer require tm/silex-sitemap-service-provider ^4.0

If you use Silex 1.3.x or lower in your application:, (*4)

composer require tm/silex-sitemap-service-provider ^3.0

Example Basic Usage

First you have to register the ServiceProvider:, (*5)

    $app->register(new TM\Provider\SitemapServiceProvider());

Optional you can also set some options for the generator:, (*6)

    $app->register(new TM\Provider\SitemapServiceProvider(), [
        'sitemap.options' => [
            'charset' => 'ISO-8859-1',
            'version' => '1.0',
            'scheme' => 'http://www.sitemaps.org/schemas/sitemap/0.8'
        ]
    ]);

Then implement the route for the sitemap.xml with your custom logic:, (*7)

    $app->get('sitemap.xml', function () use ($app) {

      $host = $app['request']->getSchemeAndHttpHost();

      $sitemap = $app['sitemap'];
      $sitemap->addEntry($host . '/', 1, 'yearly');

      $entities = $app['repository.entity']->findAll(50000);

      foreach ($entities as $entity) {
        $entityLoc = $app['url_generator']->generate('entity', array('entity' => $entity->getId()));
        $sitemap->addEntry($host . $entityLoc, 0.8, 'monthly', $entity->getLastModified());
      }

      return $sitemap->generate();
    })
    ->bind('sitemap');

Contributing

Please refer to CONTRIBUTING.md for information on how to contribute., (*8)

Development

Run tests with the following command in the project directory., (*9)

composer install
./vendor/bin/behat 

The Versions

23/02 2017

dev-release/4.x.x

dev-release/4.x.x

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

23/02 2017

4.0.0

4.0.0.0

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

10/10 2016

dev-release/3.x.x

dev-release/3.x.x

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

10/10 2016

3.0.0

3.0.0.0

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

01/06 2016

2.0.0

2.0.0.0

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

01/06 2016

1.1.1

1.1.1.0

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

08/01 2016

1.1.0

1.1.0.0

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

 

The Development Requires

xml silex sitemap

23/12 2014

1.0.0

1.0.0.0

Simple service provider to generate a xml-sitemap.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

xml silex sitemap