8573385a83
Conflicts: src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php src/Symfony/Component/ClassLoader/DebugClassLoader.php src/Symfony/Component/ClassLoader/UniversalClassLoader.php src/Symfony/Component/Console/Command/Command.php src/Symfony/Component/DependencyInjection/Definition.php src/Symfony/Component/DependencyInjection/DefinitionDecorator.php src/Symfony/Component/EventDispatcher/Event.php src/Symfony/Component/Filesystem/Exception/IOException.php src/Symfony/Component/HttpFoundation/File/File.php src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php src/Symfony/Component/HttpFoundation/Session/SessionInterface.php src/Symfony/Component/HttpFoundation/StreamedResponse.php src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php src/Symfony/Component/HttpKernel/HttpKernel.php src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/HttpKernel/KernelInterface.php src/Symfony/Component/HttpKernel/Log/LoggerInterface.php src/Symfony/Component/HttpKernel/Log/NullLogger.php src/Symfony/Component/Process/Process.php src/Symfony/Component/Routing/RequestContext.php src/Symfony/Component/Routing/Route.php src/Symfony/Component/Templating/EngineInterface.php src/Symfony/Component/Templating/PhpEngine.php src/Symfony/Component/Templating/TemplateNameParser.php src/Symfony/Component/Templating/TemplateReference.php src/Symfony/Component/Templating/TemplateReferenceInterface.php src/Symfony/Component/Translation/IdentityTranslator.php src/Symfony/Component/Translation/Translator.php src/Symfony/Component/Validator/ConstraintViolationInterface.php src/Symfony/Component/Validator/Constraints/False.php src/Symfony/Component/Validator/Constraints/FalseValidator.php src/Symfony/Component/Validator/Constraints/GroupSequence.php src/Symfony/Component/Validator/Constraints/Image.php src/Symfony/Component/Validator/Constraints/Null.php src/Symfony/Component/Validator/Constraints/NullValidator.php src/Symfony/Component/Validator/Constraints/True.php src/Symfony/Component/Validator/Constraints/TrueValidator.php src/Symfony/Component/Validator/ExecutionContextInterface.php src/Symfony/Component/Validator/ValidatorInterface.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