Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

[READ-ONLY] Subtree split of the Symfony DomCrawler Component -- clone into Symfony/Component/ (master at symfony/symfony)

Merge branch '2.4'

* 2.4:
  unified return null usages
  [Validator] added Japanese translation
  Textarea value should default to empty string instead of null.
  Fix doc blocks
  [Process] Fix #10681, process are failing on Windows Server 2003
  updated doc
  [Security] fix DBAL connection typehint
  [HttpFoundation] status 201 is allowed to have a body
  unified return null usages

latest commit 9e807943a9
Fabien Potencier fabpot authored April 18, 2014
Octocat-spinner-32 Field Merge branch '2.3' into 2.4 April 18, 2014
Octocat-spinner-32 Tests Merge branch '2.3' into 2.4 April 18, 2014
Octocat-spinner-32 .gitignore Added missing files .gitignore July 21, 2013
Octocat-spinner-32 fixed CS December 17, 2013
Octocat-spinner-32 Crawler.php Merge branch '2.4' April 18, 2014
Octocat-spinner-32 Form.php Merge branch '2.3' into 2.4 April 16, 2014
Octocat-spinner-32 FormFieldRegistry.php fixed types in phpdocs April 16, 2014
Octocat-spinner-32 LICENSE update year on licenses January 07, 2014
Octocat-spinner-32 Link.php [DomCrawler] Added support for <area> tags to be treated as links February 11, 2014
Octocat-spinner-32 updated the composer install command to reflect changes in Composer September 18, 2013
Octocat-spinner-32 composer.json updated version to 2.5 November 24, 2013
Octocat-spinner-32 phpunit.xml.dist made usage of Composer autoloader for subtree-split unit tests November 09, 2012

DomCrawler Component

DomCrawler eases DOM navigation for HTML and XML documents.

If you are familiar with jQuery, DomCrawler is a PHP equivalent:

use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filterXPath('descendant-or-self::body/p')->text();

If you are also using the CssSelector component, you can use CSS Selectors instead of XPath expressions:

use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filter('body > p')->text();


You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/DomCrawler/
$ composer.phar install
$ phpunit
Something went wrong with that request. Please try again.