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 ab1ab7ac18 merge branch '2.1' into 2.2
* 2.1:
  fixed doc references (closes #7515)
  small changes
  [SecurityBundle] Fixed configuration exemple
  idAsIndex should be true with a smallint or bigint id field.
  Fixed long multibyte parameter logging in DbalLogger:startQuery
  Keep the file extension in the temporary copy and test that it exists (closes #7482)
  [Validator][translation][japanese]replaced period to japanese one [Validator][translation][japanese]fixed japanese translation to more practical one [Validator][translation][japanese]fixed message ordering to be consistent with other languages [Validator][translation][japanese]added new validation messages in japanese translation

Conflicts:
	src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
2013-04-01 10:05:23 +02:00
..
Field merge branch '2.1' into 2.2 2013-04-01 10:05:23 +02:00
Tests merge branch '2.1' into 2.2 2013-04-01 10:05:23 +02:00
.gitignore made usage of Composer autoloader for subtree-split unit tests 2012-11-09 14:10:06 +01:00
CHANGELOG.md [DomCrawler] Added ability to set file as raw path to file field 2012-09-19 11:23:06 +02:00
composer.json use ~2.0 when depending on the CSS selector component 2013-02-08 17:10:52 +01:00
Crawler.php Merge branch '2.1' into 2.2 2013-03-01 07:43:14 +01:00
Form.php Merge branch '2.1' 2012-11-29 11:32:45 +01:00
FormFieldRegistry.php [DomCrawler] fixed a bad merge 2012-10-09 14:26:19 +02:00
LICENSE updated license year 2013-01-04 17:59:43 +01:00
Link.php Merge branch '2.1' into 2.2 2013-03-11 18:18:44 +01:00
phpunit.xml.dist made usage of Composer autoloader for subtree-split unit tests 2012-11-09 14:10:06 +01:00
README.md made usage of Composer autoloader for subtree-split unit tests 2012-11-09 14:10:06 +01: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 --dev
$ phpunit