Skip to content
Permalink
Browse files

Require dev tools and update doc

  • Loading branch information...
Kévin Gomez
Kévin Gomez committed Feb 6, 2018
1 parent a8331be commit a0e1cc98079396aa192d196e79db998eb826a8b5
Showing with 15 additions and 11 deletions.
  1. +2 −1 composer.json
  2. +9 −3 doc/more.md
  3. +4 −7 doc/usage.md
@@ -19,7 +19,8 @@
"require-dev": {
"phpunit/phpunit": "^6.5",
"symfony/routing": "^3.0|^4.0",
"friendsofphp/php-cs-fixer": "^2.10"
"friendsofphp/php-cs-fixer": "^2.10",
"kphoen/rusty": "dev-master"
},
"autoload": {
"psr-4": { "SitemapGenerator\\": "src/" }
@@ -21,8 +21,6 @@ And the following formatters are implemented:
The dumpers must implement the `Dumper` interface and the formatters the
`Formatter` interface.

The default sitemap service uses a `GzFile` dumper and a `Xml` formatter. You can
change this by overriding the sitemap service definition:

### Images and videos

@@ -47,5 +45,13 @@ If all these rules are respected, the generator will build a sitemap index.
Here is how you prepare the generator for a sitemap index:

```php
$sitemap = new Sitemap($dumper, $formatter, $base_host = 'http://www.website.com', $sitemapIndexBaseHost = 'http://www.website.com/sitemap', $limit = 50000);
<?php
use SitemapGenerator\Dumper;
use SitemapGenerator\Formatter;
use SitemapGenerator\SitemapIndex;
$dumper = new Dumper\File('sitemap-index.xml');
$formatter = new Formatter\RichXml();
$sitemap = new SitemapIndex($dumper, $formatter, $base_host = 'http://www.website.com');
```
@@ -34,18 +34,15 @@ Exemple provider:
```php
<?php
namespace SitemapGenerator\Provider;
use SitemapGenerator\Entity;
use SitemapGenerator\Provider\Provider;
class DummyProvider implements \IteratorAggregate
{
public function getIterator()
{
$url = new Entity\Url('http://www.google.fr');
$url->setChangefreq(Entity\ChangeFrequency::NEVER);
$url->setLastmod(new \DateTime('2012-12-19 02:28'));
$url->setLastmod(new \DateTimeImmutable('2012-12-19 02:28'));
yield $url;
}
@@ -70,7 +67,7 @@ In order to make the providers usable by the generator, you have to register
them:
```php
<?php
#no_run
// …
@@ -84,9 +81,9 @@ Once the sitemap is properly configured and all the providers are registered,
you can build the sitemap:

```php
<?php
#no_run
//
// ...
echo $sitemap->build();
```

0 comments on commit a0e1cc9

Please sign in to comment.
You can’t perform that action at this time.