This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DomCrawler
Fabien Potencier 6acf3e74ae Merge branch '2.5'
* 2.5:
  [Doc] Use Markdown syntax highlighting
  [Finder] tweaked docs
  [Finder] Add info about possibilities offered by SplFileInfo
  fixed CS
  [Security][Http][Authentication] Make a test pass on HHVM
  fix components tests
  [Intl] FIxed failing test
  [Intl] Generated the data for ICU version 54-rc
  [EventDispatcher] fix doc bloc on EventDispatcherInterface
  [Validator] Update validators.zh_CN.xlf, fix translation error
  bumped Symfony version to 2.5.6
  updated VERSION for 2.5.5
  updated CHANGELOG for 2.5.5
  bumped Symfony version to 2.3.21
  updated VERSION for 2.3.20
  update CONTRIBUTORS for 2.3.20
  updated CHANGELOG for 2.3.20
  [Intl] Integrated ICU data into Intl component

Conflicts:
	src/Symfony/Component/Debug/README.md
	src/Symfony/Component/DependencyInjection/README.md
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/OptionsResolver/README.md
2014-10-01 07:53:11 +02:00
..
Field Merge branch '2.4' 2014-05-21 18:04:07 +02:00
Tests Merge branch '2.5' 2014-09-22 13:59:59 +02:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md Changed the default value of checkbox and radio to match the HTML spec 2014-05-17 22:15:05 +02:00
composer.json updated version to 2.6 2014-05-23 16:36:49 +02:00
Crawler.php Merge branch '2.5' 2014-08-26 16:16:42 +02:00
Form.php Merge branch '2.4' into 2.5 2014-08-26 16:16:33 +02:00
FormFieldRegistry.php fixed CS 2014-09-22 10:32:35 +02:00
LICENSE update year on licenses 2014-01-07 08:19:25 -05:00
Link.php Merge branch '2.4' into 2.5 2014-07-08 14:21:33 +02:00
phpunit.xml.dist removed defaults from PHPUnit configuration 2014-07-07 12:13:42 +02:00
README.md [Doc] Use Markdown syntax highlighting 2014-10-01 07:38:33 +02:00

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();

Resources

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/DomCrawler/
$ composer.phar install
$ phpunit