2017 © Pedro Peláez
 

library sitemap

Library for the generate sitemap

image

fdevs/sitemap

Library for the generate sitemap

  • Saturday, October 22, 2016
  • by andrey1s
  • Repository
  • 3 Watchers
  • 0 Stars
  • 53 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

Status

Build Status, (*1)

Sitemap

use rules Sitemaps XML format for the generate sitemap, (*2)

If you use Symfony 2, you could use our sitemap bridge or sitemap bundle!, (*3)

Installation

Sitemap uses Composer, please checkout the composer website for more information., (*4)

The simple following command will install sitemap into your project. It also add a new entry in your composer.json and update the composer.lock as well., (*5)

composer require fdevs/sitemap

Usage examples:

create your adapter

 'ru', '_format' => 'html'],
    ['_locale' => 'en', '_format' => 'html'],
    ['_locale' => 'ru', '_format' => 'rss'],
    ['_locale' => 'en', '_format' => 'rss'],
];

echo $urlset->xmlString($params);
//<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://4devs.io/ru</loc><priority>0.7</priority></url></urlset>

//or save sitemap
$urlset->saveFile('/full/path/to/sitemap.xml',$params);

usage SiteMapIndex

use FDevs\Sitemap\Factory\SiteMapIndex;

$index = new SiteMapIndex('http://domain.ltd','/full/path/to/web/dir');

// your params for the uri
$params = [
    ['_locale' => 'ru', '_format' => 'html'],
    ['_locale' => 'en', '_format' => 'html'],
];

echo $index->xmlString($params);
//<sitemapindex><sitemap><loc>http://domain.ltd/ru.html.sitemap.xml</loc></sitemap><sitemap><loc>http://domain.ltd/en.html.sitemap.xml</loc></sitemap></sitemapindex>

//or save sitemap
$index->saveFile('/full/path/to/sitemap.xml',$params);

usage Params helper

use FDevs\Sitemap\Util\Params;
$params = Params::prepare(['_locale'=>['ru','en'],'_format'=>['html','rss']])
//output
//$params = [
//    ['_locale' => 'ru', '_format' => 'html'],
//    ['_locale' => 'en', '_format' => 'html'],
//    ['_locale' => 'ru', '_format' => 'rss'],
//    ['_locale' => 'en', '_format' => 'rss'],
//];

usage sitemap manager

use FDevs\Sitemap\SitemapManager;
use FDevs\Sitemap\Factory\SiteMapIndex;
use FDevs\Sitemap\Factory\UrlSet;
use FDevs\Sitemap\Util\Params;

$index = new SiteMapIndex('http://domain.ltd','/full/path/to/web/dir');
$urlset = new UrlSet();
$params = Params::prepare(['_locale'=>['ru','en'],'_format'=>['html','xml']])

$manager = new SitemapManager();
$manager
    ->add($urlset)
    ->add($index);

$manager->get('index')->xmlString($params);
$manager->get('index')->saveFile('/full/path/to/sitemap.xml',$params);

$manager->get('sitemap')->xmlString($params);
$manager->get('sitemap')->saveFile('/full/path/to/sitemapindex.xml',$params);


Created by 4devs - Check out our blog for more insight into this and other open-source projects we release., (*6)

The Versions

22/10 2016

dev-master

9999999-dev https://github.com/4devs/sitemap

Library for the generate sitemap

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

  • mikey179/vfsstream 1.*

seo sitemap

17/06 2016

0.1.1

0.1.1.0 https://github.com/4devs/sitemap

Library for the generate sitemap

  Sources   Download

MIT

The Requires

  • php >=5.4

 

seo sitemap

16/06 2016

0.1.0

0.1.0.0 https://github.com/4devs/sitemap

Library for the generate sitemap

  Sources   Download

MIT

The Requires

  • php >=5.4

 

seo sitemap