symfony/panther
Symfony Panther is a PHP library for end-to-end browser testing and web scraping using real browsers like Chrome and Firefox. Built on the W3C WebDriver protocol, it drives native browsers for reliable automation in Symfony or standalone.
Start by installing the package via Composer (composer require --dev symfony/panther) and enabling the Panther service in your phpunit.xml (or using the dedicated PantherTestCase base class). Your first test typically involves extending PantherTestCase and using the client to simulate a real browser—e.g., visiting a page, asserting text, and interacting with DOM elements. Example first use case:
class ExampleTest extends PantherTestCase
{
public function test_homepage_contains_title(): void
{
$client = self::createPantherClient();
$crawler = $client->request('GET', '/');
$this->assertSelectorTextContains('h1', 'Welcome');
}
}
Check the official Panther documentation for setup details, especially regarding ChromeDriver/GeckoDriver installation if not using the bundled binary.
$client->clickLink('Next'); $data = $crawler->filter('.article')->each(...);symfony/panther base image) to avoid driver compatibility issues.$client->waitFor() or promise-based waiting ($client->waitUntil(...)) to handle reactive UIs gracefully.createPantherClient() with an options array (e.g., ['headless' => false, 'browser_language' => 'fr']).composer.json constraints.PANTHER_HEADLESS is set or specify headless in client options.$crawler->filter(...)->first() over direct array access.ChromeClient and passing it to createPantherClient().How can I help you explore Laravel packages today?