2017 © Pedro Peláez
 

library next-php-sitemap-generator

Yet another sitemap generator in PHP.

image

havramar/next-php-sitemap-generator

Yet another sitemap generator in PHP.

  • Thursday, January 15, 2015
  • by havramar
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5,658 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

next-php-sitemap-generator

Yet another sitemap generator in PHP., (*1)

Build Status SensioLabsInsight, (*2)

Why?

Needed more customizable sitemap generator:, (*3)

  • switch format output,
  • create only index files basing on config input,
  • helper constants for some values,
  • some other :)

Adding to existing project

composer require havramar/next-php-sitemap-generator:dev-master

How to run

  1. Get composer, (*4)

    curl -sS https://getcomposer.org/installer | php
    
  2. Install dependencies, (*5)

    php composer.phar install
    
  3. Create example script example.php, (*6)

    <?php
    
    require_once 'vendor/autoload.php';
    
    $sitemapCreator = new \SitemapGenerator\SitemapCreator();
    $sitemapCreator->setDomain('http://www.example.com');
    
    $url = new \SitemapGenerator\Url();
    $url->loc = '/home';
    $url->changefreq = \SitemapGenerator\Url::FREQ_HOURLY;
    
    $sitemapCreator->addUrl($url);
    
    $indexCreator = $sitemapCreator->buildIndexCreator();
    $indexCreator->createIndex('http://www.example.com/sitemaps/');
    
  4. Run example, (*7)

    php example.php
    
  5. Two files were created in current directory, (*8)

  • sitemap-1.xml, (*9)

    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
     <url>
      <loc>http://www.example.com/home</loc>
      <changefreq>hourly</changefreq>
     </url>
    </urlset>
    
  • sitemap-index-1.xml, (*10)

    <?xml version="1.0" encoding="UTF-8"?>
    <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
     <sitemap>
      <loc>http://www.example.com/sitemaps/sitemap-1.xml</loc>
     </sitemap>
    </sitemapindex>
    

More examples

More examples can be found in tests file., (*11)

How to run tests

vendor/bin/phpunit --configuration tests

The Versions

15/01 2015

dev-master

9999999-dev

Yet another sitemap generator in PHP.

  Sources   Download

MIT

The Development Requires

generator sitemap