Skip to content

Commit

Permalink
Merge pull request #40 from nilportugues/3.0.0-alpha
Browse files Browse the repository at this point in the history
3.0.0-alpha merge to master
  • Loading branch information
nilportugues committed Dec 21, 2014
2 parents 6425ada + e622a79 commit 601a583
Show file tree
Hide file tree
Showing 115 changed files with 16,579 additions and 7,716 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#---------------------------------------------------
# PHP Project files to ignore
#---------------------------------------------------
.idea/
build/
vendor/
bin/
tmp/
Expand Down
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
language: php
cache:
directories:
- vendor
php:
- 5.6
- 5.5
- 5.4
- 5.3
- hhvm
- hhvm-nightly

before_script:
- alias composer="php -d zend.enable_gc=0 /usr/bin/composer"
- composer require --dev satooshi/php-coveralls:dev-master
- composer install

after_script:
- php bin/coveralls -v

script:
- phpunit --coverage-text
- bin/phpunit --coverage-text
- bin/phpunit-randomizer --order rand

matrix:
allow_failures:
- php: hhvm
- php: hhvm-nightly
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Contributing
============

First of all, **thank you** for contributing, **you are awesome**!

Here are a few rules to follow in order to ease code reviews, and discussions before
maintainers accept and merge your work.

You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
[PSR-2](http://www.php-fig.org/psr/2/). If you don't know about any of them, you
should really read the recommendations. Can't wait? Use the [PHP-CS-Fixer
tool](http://cs.sensiolabs.org/).

You MUST run the test suite.

You MUST write (or update) unit tests.

You SHOULD write documentation.

Please, write [commit messages that make
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing)
before submitting your Pull Request.

One may ask you to [squash your
commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
too. This is used to "clean" your Pull Request before merging it (we don't want
commits such as `fix tests`, `fix 2`, `fix 3`, etc.).

Also, while creating your Pull Request on GitHub, you MUST write a description
which gives the context and/or explains why you are creating it.

Thank you!
112 changes: 50 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sitemap Component
=================

[![Build Status](https://travis-ci.org/nilportugues/sitemap-component.png)](https://travis-ci.org/nilportugues/sitemap-component) [![Coverage Status](https://img.shields.io/coveralls/nilportugues/sitemap-component.svg)](https://coveralls.io/r/nilportugues/sitemap-component) [![Latest Stable Version](https://poser.pugx.org/sonrisa/sitemap-component/v/stable.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![Total Downloads](https://poser.pugx.org/sonrisa/sitemap-component/downloads.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![Latest Unstable Version](https://poser.pugx.org/sonrisa/sitemap-component/v/unstable.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![License](https://poser.pugx.org/sonrisa/sitemap-component/license.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/b065a032-4ab2-4feb-a88c-d7a8423e1cf7/mini.png)](https://insight.sensiolabs.com/projects/b065a032-4ab2-4feb-a88c-d7a8423e1cf7)
[![Build Status](https://travis-ci.org/nilportugues/sitemap-component.png)](https://travis-ci.org/nilportugues/sitemap-component) [![Coverage Status](https://img.shields.io/coveralls/nilportugues/sitemap-component.svg)](https://coveralls.io/r/nilportugues/sitemap-component) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nilportugues/sitemap-component/badges/quality-score.png?b=3.0.0-alpha)](https://scrutinizer-ci.com/g/nilportugues/sitemap-component/?branch=3.0.0-alpha) [![Latest Stable Version](https://poser.pugx.org/sonrisa/sitemap-component/v/stable.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![Total Downloads](https://poser.pugx.org/sonrisa/sitemap-component/downloads.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![License](https://poser.pugx.org/sonrisa/sitemap-component/license.svg)](https://packagist.org/packages/sonrisa/sitemap-component) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/b065a032-4ab2-4feb-a88c-d7a8423e1cf7/mini.png)](https://insight.sensiolabs.com/projects/b065a032-4ab2-4feb-a88c-d7a8423e1cf7)

Builds sitemaps for pages, images and media files and provides a class to submit them to search engines.

Expand Down Expand Up @@ -40,7 +40,7 @@ Add the following to your `composer.json` file :
```js
{
"require": {
"sonrisa/sitemap-component":"dev-master"
"sonrisa/sitemap-component":"3.0.0"
}
}
```
Expand Down Expand Up @@ -98,7 +98,7 @@ This component also provides a method to submit the generated sitemaps to the fo
### 4.1 - Submit to search engines
```php
<?php
use Sonrisa\Component\Sitemap\SubmitSitemap;
use NilPortugues\Sitemap\SubmitSitemap;

// $status = array('google' => true, 'bing' => true); if everything went OK.
$status = SubmitSitemap::send('http://example.com/sitemap-index.xml');
Expand All @@ -114,21 +114,19 @@ In order to use a Sitemap Index, you need to build sitemap files first. Check ou
```php
<?php
include 'vendor/autoload.php';
use \Sonrisa\Component\Sitemap\IndexSitemap;
use \Sonrisa\Component\Sitemap\Items\IndexItem;
use \Sonrisa\Component\Sitemap\Exceptions\SitemapException;
use NilPortugues\Sitemap\IndexSitemap;
use NilPortugues\Sitemap\Item\Index\IndexItem;
use NilPortugues\Sitemap\SitemapException;

try {
$sitemap = new IndexSitemap();

$item = new IndexItem();
$item->setLoc('http://www.example.com/sitemap.content.xml'); //Mandatory
$item = new IndexItem('http://www.example.com/sitemap.content.xml');
$item->setLastMod('2005-05-10T17:33:30+08:00'); //Optional
$sitemap->add($item);

$item = new IndexItem();
$item->setLoc('http://www.example.com/sitemap.media.xml'); //Mandatory
$item->setLastMod('2005-05-10T17:33:30+08:00'); //Optional
$item = new IndexItem('http://www.example.com/sitemap.media.xml');
$item->setLastMod('2005-05-10T17:33:30+08:00');
$sitemap->add($item);

//var_dump($files) should be an array holding the sitemap files created.
Expand Down Expand Up @@ -165,34 +163,31 @@ try {
```php
<?php
include 'vendor/autoload.php';
use \Sonrisa\Component\Sitemap\Sitemap;
use \Sonrisa\Component\Sitemap\Items\UrlItem;
use \Sonrisa\Component\Sitemap\Exceptions\SitemapException;
use NilPortugues\Sitemap\Sitemap;
use NilPortugues\Sitemap\Item\Url\UrlItem;
use NilPortugues\Sitemap\SitemapException;

try {
$sitemap = new Sitemap();

$item = new UrlItem();
$item->setLoc('http://www.example.com/'); //Mandatory
$item = new UrlItem('http://www.example.com/');
$item->setPriority('1.0'); //Optional
$item->setChangeFreq('daily'); //Optional
$item->setLastMod('2014-05-10T17:33:30+08:00'); //Optional

$sitemap->add($item);

$item = new UrlItem();
$item->setLoc('http://www.example.com/blog'); //Mandatory
$item->setPriority('0.9'); //Optional
$item->setChangeFreq('monthly'); //Optional
$item->setLastMod('2014-05-10T17:33:30+08:00'); //Optional
$item = new UrlItem('http://www.example.com/blog');
$item->setPriority('0.9');
$item->setChangeFreq('monthly');
$item->setLastMod('2014-05-10T17:33:30+08:00');

$sitemap->add($item);

$item = new UrlItem();
$item->setLoc('http://www.example.com/contact'); //Mandatory
$item->setPriority('0.8'); //Optional
$item->setChangeFreq('never'); //Optional
$item->setLastMod('2014-05-10T17:33:30+08:00'); //Optional
$item = new UrlItem('http://www.example.com/contact');
$item->setPriority('0.8');
$item->setChangeFreq('never');
$item->setLastMod('2014-05-10T17:33:30+08:00');

$sitemap->add($item);

Expand Down Expand Up @@ -239,21 +234,19 @@ try {
```php
<?php
include 'vendor/autoload.php';
use \Sonrisa\Component\Sitemap\ImageSitemap;
use \Sonrisa\Component\Sitemap\Items\ImageItem;
use \Sonrisa\Component\Sitemap\Exceptions\SitemapException;
use NilPortugues\Sitemap\ImageSitemap;
use NilPortugues\Sitemap\Item\Image\ImageItem;
use NilPortugues\Sitemap\SitemapException;

try {
$sitemap = new ImageSitemap();

$item = new ImageItem();
$item->setLoc('http://www.example.com/logo.png'); //Mandatory
$item = new ImageItem('http://www.example.com/logo.png');
$item->setTitle('Example.com logo'); //Optional

$sitemap->add($item,'http://www.example.com/');

$item = new ImageItem();
$item->setLoc('http://www.example.com/main.png'); //Mandatory
$item = new ImageItem('http://www.example.com/main.png');
$item->setTitle('Main image'); //Optional

$sitemap->add($item,'http://www.example.com/');
Expand Down Expand Up @@ -296,19 +289,18 @@ xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
```php
<?php
include 'vendor/autoload.php';
use \Sonrisa\Component\Sitemap\VideoSitemap;
use \Sonrisa\Component\Sitemap\Items\VideoItem;
use \Sonrisa\Component\Sitemap\Exceptions\SitemapException;
use NilPortugues\Sitemap\VideoSitemap;
use NilPortugues\Sitemap\Item\Video\VideoItem;
use NilPortugues\Sitemap\SitemapException;

try {
$sitemap = new VideoSitemap();

$item = new VideoItem();

//Mandatory values
$item->setTitle('Grilling steaks for summer');
$item->setContentLoc('http://www.example.com/video123.flv');
$item->setPlayerLoc('http://www.example.com/videoplayer.swf?video=123');
$item = new VideoItem(
'Grilling steaks for summer', //Title
'http://www.example.com/video123.flv', //URL
'http://www.example.com/videoplayer.swf?video=123' //Player URL
);

//Optional Values
$item->setDescription('Alkis shows you how to get perfectly done steaks everytime');
Expand Down Expand Up @@ -385,19 +377,17 @@ try {
```php
<?php
include 'vendor/autoload.php';
use \Sonrisa\Component\Sitemap\MediaSitemap;
use \Sonrisa\Component\Sitemap\Items\MediaItem;
use \Sonrisa\Component\Sitemap\Exceptions\SitemapException;
use NilPortugues\Sitemap\MediaSitemap;
use NilPortugues\Sitemap\Item\Media\MediaItem;
use NilPortugues\Sitemap\SitemapException;

try {
$sitemap = new MediaSitemap();
$sitemap->setTitle('Media RSS de ejemplo');
$sitemap->setLink('http://www.example.com/ejemplos/mrss/');
$sitemap->setDescription('Ejemplo de MRSS');

$item = new MediaItem();
//Mandatory
$item->setLink('http://www.example.com/examples/mrss/example1.html');
$item = new MediaItem('http://www.example.com/examples/mrss/example1.html');

//Optional
$item->setContentMimeType('video/x-flv');
Expand All @@ -411,8 +401,7 @@ try {

$sitemap->add($item);

$item = new MediaItem();
$item->setLink('http://www.example.com/examples/mrss/example2.html');
$item = new MediaItem('http://www.example.com/examples/mrss/example2.html');
$item->setContentMimeType('video/x-flv');
$item->setPlayer('http://www.example.com/shows/example/video.swf?flash_params');
$item->setContentDuration(240);
Expand Down Expand Up @@ -471,21 +460,20 @@ try {
```php
<?php
include 'vendor/autoload.php';
use \Sonrisa\Component\Sitemap\NewsSitemap;
use \Sonrisa\Component\Sitemap\Items\NewsItem;
use \Sonrisa\Component\Sitemap\Exceptions\SitemapException;
use NilPortugues\Sitemap\NewsSitemap;
use NilPortugues\Sitemap\Item\News\NewsItem;
use NilPortugues\Sitemap\SitemapException;

try {
$sitemap = new NewsSitemap();

$item = new NewsItem();

//Mandatory values
$item->setLoc('http://www.example.org/business/article55.html');
$item->setTitle('Companies A, B in Merger Talks');
$item->setPublicationDate('2008-12-23');
$item->setPublicationName('The Example Times');
$item->setPublicationLanguage('en');
$item = new NewsItem(
'http://www.example.org/business/article55.html', //URL
'Companies A, B in Merger Talks', //Title
'2008-12-23', //Publication Date
'The Example Times', //Publication Name
'en' //locale
);

//Optional Values
$item->setAccess('Subscription');
Expand Down Expand Up @@ -531,7 +519,7 @@ try {

<a name="block5"></a>
## 5. Fully tested.
Testing has been done using PHPUnit and [Travis-CI](https://travis-ci.org). All code has been tested to be compatible from PHP 5.3 up to PHP 5.6 and [Facebook's HHVM](http://hhvm.com/).
Testing has been done using PHPUnit and [Travis-CI](https://travis-ci.org). All code has been tested to be compatible from PHP 5.4 up to PHP 5.6 and [Facebook's HHVM](http://hhvm.com/).

---

Expand Down
14 changes: 0 additions & 14 deletions V3_AND_PERFORMANCE.MD

This file was deleted.

17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name":"sonrisa/sitemap-component",
"name":"nilportugues/sitemap-component",
"description":"Standalone sitemap builder 100% standards compliant. Build for PHP5.3 and above.",
"keywords": [ "sitemap", "xml", "image", "news", "video", "media", "index" ],
"type":"library",
Expand All @@ -15,7 +15,7 @@
}
],
"require":{
"php":">=5.3.0"
"php":">=5.4"
},
"require-dev":
{
Expand All @@ -28,15 +28,20 @@
"fabpot/php-cs-fixer": "dev-master",
"pdepend/pdepend": "2.*",
"phpmd/phpmd": "dev-master",
"goatherd/phpcs_installer": "2.*@dev",
"squizlabs/php_codesniffer": "2.*@dev"
"squizlabs/php_codesniffer": "2.*@dev",
"fiunchinho/phpunit-randomizer": "1.0.*@dev"
},
"config":{
"bin-dir":"bin/"
},
"autoload":{
"psr-0":{
"Sonrisa\\Component\\Sitemap":"src/"
"psr-4":{
"NilPortugues\\Sitemap\\":"src/"
}
},
"autoload-dev":{
"psr-4":{
"Tests\\NilPortugues\\Sitemap\\":"tests/"
}
},
"minimum-stability": "stable"
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="true"
stopOnFailure="false"
syntaxCheck="true"
bootstrap="vendor/autoload.php"
>
Expand All @@ -22,7 +22,7 @@

<testsuites>
<testsuite name="Test Suite">
<directory>./tests/Sonrisa/Component/Sitemap/</directory>
<directory>./tests/</directory>
</testsuite>
</testsuites>

Expand Down
Loading

0 comments on commit 601a583

Please sign in to comment.