fc009c16d7
* 2.3: Changed visibility of setUp() and tearDown to protected fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses Test with local components instead of waiting for the subtree-splitter when possible Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php src/Symfony/Component/Config/Util/XmlUtils.php src/Symfony/Component/Console/Helper/ProgressHelper.php src/Symfony/Component/Debug/ExceptionHandler.php src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php src/Symfony/Component/Filesystem/Tests/FilesystemTest.php src/Symfony/Component/OptionsResolver/Options.php src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php src/Symfony/Component/Yaml/Inline.php |
||
---|---|---|
.. | ||
Field | ||
Tests | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
Crawler.php | ||
Form.php | ||
FormFieldRegistry.php | ||
LICENSE | ||
Link.php | ||
phpunit.xml.dist | ||
README.md |
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 install
$ phpunit