• Stars
    star
    2,742
  • Rank 16,610 (Top 0.4 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A browser testing and web crawling library for PHP and Symfony

Panther

A browser testing and web scraping library for PHP and Symfony

CI

Panther is a convenient standalone library to scrape websites and to run end-to-end tests using real browsers.

Panther is super powerful. It leverages the W3C's WebDriver protocol to drive native web browsers such as Google Chrome and Firefox.

Panther is very easy to use, because it implements Symfony's popular BrowserKit and DomCrawler APIs, and contains all the features you need to test your apps. It will sound familiar if you have ever created a functional test for a Symfony app: as the API is exactly the same! Keep in mind that Panther can be used in every PHP project, as it is a standalone library.

Panther automatically finds your local installation of Chrome or Firefox and launches them, so you don't need to install anything else on your computer, a Selenium server is not needed!

In test mode, Panther automatically starts your application using the PHP built-in web-server. You can focus on writing your tests or web-scraping scenario and Panther will take care of everything else.

Features

Unlike testing and web scraping libraries you're used to, Panther:

  • executes the JavaScript code contained in webpages
  • supports everything that Chrome (or Firefox) implements
  • allows taking screenshots
  • can wait for asynchronously loaded elements to show up
  • lets you run your own JS code or XPath queries in the context of the loaded page
  • supports custom Selenium server installations
  • supports remote browser testing services including SauceLabs and BrowserStack

Documentation

Installing Panther

Use Composer to install Panther in your project. You may want to use the --dev flag if you want to use Panther for testing only and not for web scraping in a production environment:

composer req symfony/panther

composer req --dev symfony/panther

Installing ChromeDriver and geckodriver

Panther uses the WebDriver protocol to control the browser used to crawl websites.

On all systems, you can use dbrekelmans/browser-driver-installer to install ChromeDriver and geckodriver locally:

composer require --dev dbrekelmans/bdi
vendor/bin/bdi detect drivers

Panther will detect and use automatically drivers stored in the drivers/ directory.

Alternatively, you can use the package manager of your operating system to install them.

On Ubuntu, run:

apt-get install chromium-chromedriver firefox-geckodriver

On Mac, using Homebrew:

brew install chromedriver geckodriver

On Windows, using chocolatey:

choco install chromedriver selenium-gecko-driver

Finally, you can download manually ChromeDriver (for Chromium or Chrome) and GeckoDriver (for Firefox) and put them anywhere in your PATH or in the drivers/ directory of your project.

Registering the PHPUnit Extension

If you intend to use Panther to test your application, we strongly recommend registering the Panther PHPUnit extension. While not strictly mandatory, this extension dramatically improves the testing experience by boosting the performance and allowing to use the interactive debugging mode.

When using the extension in conjunction with the PANTHER_ERROR_SCREENSHOT_DIR environment variable, tests using the Panther client that fail or error (after the client is created) will automatically get a screenshot taken to help debugging.

To register the Panther extension, add the following lines to phpunit.xml.dist:

<!-- phpunit.xml.dist -->
<extensions>
    <extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>

Without the extension, the web server used by Panther to serve the application under test is started on demand and stopped when tearDownAfterClass() is called. On the other hand, when the extension is registered, the web server will be stopped only after the very last test.

Basic Usage

<?php

use Symfony\Component\Panther\Client;

require __DIR__.'/vendor/autoload.php'; // Composer's autoloader

$client = Client::createChromeClient();
// Or, if you care about the open web and prefer to use Firefox
$client = Client::createFirefoxClient();

$client->request('GET', 'https://api-platform.com'); // Yes, this website is 100% written in JavaScript
$client->clickLink('Getting started');

// Wait for an element to be present in the DOM (even if hidden)
$crawler = $client->waitFor('#installing-the-framework');
// Alternatively, wait for an element to be visible
$crawler = $client->waitForVisibility('#installing-the-framework');

echo $crawler->filter('#installing-the-framework')->text();
$client->takeScreenshot('screen.png'); // Yeah, screenshot!

Testing Usage

The PantherTestCase class allows you to easily write E2E tests. It automatically starts your app using the built-in PHP web server and let you crawl it using Panther. To provide all the testing tools you're used to, it extends PHPUnit's TestCase.

If you are testing a Symfony application, PantherTestCase automatically extends the WebTestCase class. It means you can easily create functional tests, which can directly execute the kernel of your application and access all your existing services. In this case, you can use all crawler test assertions provided by Symfony with Panther.

<?php

namespace App\Tests;

use Symfony\Component\Panther\PantherTestCase;

class E2eTest extends PantherTestCase
{
    public function testMyApp(): void
    {
        $client = static::createPantherClient(); // Your app is automatically started using the built-in web server
        $client->request('GET', '/mypage');

        // Use any PHPUnit assertion, including the ones provided by Symfony
        $this->assertPageTitleContains('My Title');
        $this->assertSelectorTextContains('#main', 'My body');
        
        // Or the one provided by Panther
        $this->assertSelectorIsEnabled('.search');
        $this->assertSelectorIsDisabled('[type="submit"]');
        $this->assertSelectorIsVisible('.errors');
        $this->assertSelectorIsNotVisible('.loading');
        $this->assertSelectorAttributeContains('.price', 'data-old-price', '42');
        $this->assertSelectorAttributeNotContains('.price', 'data-old-price', '36');

        // Use waitForX methods to wait until some asynchronous process finish
        $client->waitFor('.popin'); // wait for element to be attached to the DOM
        $client->waitForStaleness('.popin'); // wait for element to be removed from the DOM
        $client->waitForVisibility('.loader'); // wait for element of the DOM to become visible
        $client->waitForInvisibility('.loader'); // wait for element of the DOM to become hidden
        $client->waitForElementToContain('.total', '25 €'); // wait for text to be inserted in the element content
        $client->waitForElementToNotContain('.promotion', '5%'); // wait for text to be removed from the element content
        $client->waitForEnabled('[type="submit"]'); // wait for the button to become enabled 
        $client->waitForDisabled('[type="submit"]'); // wait for  the button to become disabled 
        $client->waitForAttributeToContain('.price', 'data-old-price', '25 €'); // wait for the attribute to contain content
        $client->waitForAttributeToNotContain('.price', 'data-old-price', '25 €'); // wait for the attribute to not contain content
        
        // Let's predict the future
        $this->assertSelectorWillExist('.popin'); // element will be attached to the DOM
        $this->assertSelectorWillNotExist('.popin'); // element will be removed from the DOM
        $this->assertSelectorWillBeVisible('.loader'); // element will be visible
        $this->assertSelectorWillNotBeVisible('.loader'); // element will not be visible
        $this->assertSelectorWillContain('.total', '€25'); // text will be inserted in the element content
        $this->assertSelectorWillNotContain('.promotion', '5%'); // text will be removed from the element content
        $this->assertSelectorWillBeEnabled('[type="submit"]'); // button will be enabled 
        $this->assertSelectorWillBeDisabled('[type="submit"]'); // button will be disabled 
        $this->assertSelectorAttributeWillContain('.price', 'data-old-price', '€25'); // attribute will contain content
        $this->assertSelectorAttributeWillNotContain('.price', 'data-old-price', '€25'); // attribute will not contain content
    }
}

To run this test:

bin/phpunit tests/E2eTest.php

A Polymorphic Feline

Panther also gives you instant access to other BrowserKit-based implementations of Client and Crawler. Unlike Panther's native client, these alternative clients don't support JavaScript, CSS and screenshot capturing, but they are super-fast!

Two alternative clients are available:

  • The first directly manipulates the Symfony kernel provided by WebTestCase. It is the fastest client available, but it is only available for Symfony apps.
  • The second leverages Symfony's HttpBrowser. It is an intermediate between Symfony's kernel and Panther's test clients. HttpBrowser sends real HTTP requests using Symfony's HttpClient component. It is fast and is able to browse any webpage, not only the ones of the application under test. However, HttpBrowser doesn't support JavaScript and other advanced features because it is entirely written in PHP. This one is available even for non-Symfony apps!

The fun part is that the 3 clients implement the exact same API, so you can switch from one to another just by calling the appropriate factory method, resulting in a good trade-off for every single test case (Do I need JavaScript? Do I need to authenticate with an external SSO server? Do I want to access the kernel of the current request? ... etc).

Here is how to retrieve instances of these clients:

<?php

namespace App\Tests;

use Symfony\Component\Panther\PantherTestCase;
use Symfony\Component\Panther\Client;

class E2eTest extends PantherTestCase
{
    public function testMyApp(): void
    {
        $symfonyClient = static::createClient(); // A cute kitty: Symfony's functional test tool
        $httpBrowserClient = static::createHttpBrowserClient(); // An agile lynx: HttpBrowser
        $pantherClient = static::createPantherClient(); // A majestic Panther
        $firefoxClient = static::createPantherClient(['browser' => static::FIREFOX]); // A splendid Firefox
        // Both HttpBrowser and Panther benefits from the built-in HTTP server

        $customChromeClient = Client::createChromeClient(null, null, [], 'https://example.com'); // Create a custom Chrome client
        $customFirefoxClient = Client::createFirefoxClient(null, null, [], 'https://example.com'); // Create a custom Firefox client
        $customSeleniumClient = Client::createSeleniumClient('http://127.0.0.1:4444/wd/hub', null, 'https://example.com'); // Create a custom Selenium client
        // When initializing a custom client, the integrated web server IS NOT started automatically.
        // Use PantherTestCase::startWebServer() or WebServerManager if you want to start it manually.

        // enjoy the same API for the 3 felines
        // $*client->request('GET', '...')

        $kernel = static::createKernel(); // If you are testing a Symfony app, you also have access to the kernel

        // ...
    }
}

Creating Isolated Browsers to Test Apps Using Mercure or WebSocket

Panther provides a convenient way to test applications with real-time capabilities which use Mercure, WebSocket and similar technologies.

PantherTestCase::createAdditionalPantherClient() creates additional, isolated browsers which can interact with each other. For instance, this can be useful to test a chat application having several users connected simultaneously:

<?php

use Symfony\Component\Panther\PantherTestCase;

class ChatTest extends PantherTestCase
{
    public function testChat(): void
    {
        $client1 = self::createPantherClient();
        $client1->request('GET', '/chat'); 
 
        // Connect a 2nd user using an isolated browser and say hi!
        $client2 = self::createAdditionalPantherClient();
        $client2->request('GET', '/chat');
        $client2->submitForm('Post message', ['message' => 'Hi folks 👋😻']);

        // Wait for the message to be received by the first client
        $client1->waitFor('.message');

        // Symfony Assertions are always executed in the **primary** browser
        $this->assertSelectorTextContains('.message', 'Hi folks 👋😻');
    }
}

Accessing Browser Console Logs

If needed, you can use Panther to access the content of the console:

<?php

use Symfony\Component\Panther\PantherTestCase;

class ConsoleTest extends PantherTestCase
{
    public function testConsole(): void
    {
        $client = self::createPantherClient(
            [],
            [],
            [
                'capabilities' => [
                    'goog:loggingPrefs' => [
                        'browser' => 'ALL', // calls to console.* methods
                        'performance' => 'ALL', // performance data
                    ],
                ],
            ]
        );

        $client->request('GET', '/');
        $consoleLogs = $client->getWebDriver()->manage()->getLog('browser'); // console logs 
        $performanceLogs = $client->getWebDriver()->manage()->getLog('performance'); // performance logs
    }
}

Passing Arguments to ChromeDriver

If needed, you can configure the arguments to pass to the chromedriver binary:

<?php

use Symfony\Component\Panther\PantherTestCase;

class MyTest extends PantherTestCase
{
    public function testLogging(): void
    {
        $client = self::createPantherClient(
            [],
            [],
            [
                'chromedriver_arguments' => [
                    '--log-path=myfile.log',
                    '--log-level=DEBUG'
                ],
            ]
        );

        $client->request('GET', '/');
    }
}

Checking the State of the WebDriver Connection

Use the Client::ping() method to check if the WebDriver connection is still active (useful for long-running tasks).

Additional Documentation

Since Panther implements the API of popular libraries, it already has an extensive documentation:

Environment Variables

The following environment variables can be set to change some Panther's behaviour:

  • PANTHER_NO_HEADLESS: to disable the browser's headless mode (will display the testing window, useful to debug)
  • PANTHER_WEB_SERVER_DIR: to change the project's document root (default to ./public/, relative paths must start by ./)
  • PANTHER_WEB_SERVER_PORT: to change the web server's port (default to 9080)
  • PANTHER_WEB_SERVER_ROUTER: to use a web server router script which is run at the start of each HTTP request
  • PANTHER_EXTERNAL_BASE_URI: to use an external web server (the PHP built-in web server will not be started)
  • PANTHER_APP_ENV: to override the APP_ENV variable passed to the web server running the PHP app
  • PANTHER_ERROR_SCREENSHOT_DIR: to set a base directory for your failure/error screenshots (e.g. ./var/error-screenshots)
  • PANTHER_DEVTOOLS: to toggle the browser's dev tools (default enabled, useful to debug)
  • PANTHER_ERROR_SCREENSHOT_ATTACH: to add screenshots mentioned above to test output in junit attachment format

Changing the Hostname and Port of the Built-in Web Server

If you want to change the host and/or the port used by the built-in web server, pass the hostname and port to the $options parameter of the createPantherClient() method:

// ...

$client = self::createPantherClient([
    'hostname' => 'example.com', // Defaults to 127.0.0.1
    'port' => 8080, // Defaults to 9080
]);

Chrome-specific Environment Variables

  • PANTHER_NO_SANDBOX: to disable Chrome's sandboxing (unsafe, but allows to use Panther in containers)
  • PANTHER_CHROME_ARGUMENTS: to customize Chrome arguments. You need to set PANTHER_NO_HEADLESS to fully customize.
  • PANTHER_CHROME_BINARY: to use another google-chrome binary

Firefox-specific Environment Variables

  • PANTHER_FIREFOX_ARGUMENTS: to customize Firefox arguments. You need to set PANTHER_NO_HEADLESS to fully customize.
  • PANTHER_FIREFOX_BINARY: to use another firefox binary

Accessing To Hidden Text

According to the spec, WebDriver implementations return only the displayed text by default. When you filter on a head tag (like title), the method text() returns an empty string. Use the method html() to get the complete contents of the tag, including the tag itself.

Interactive Mode

Panther can make a pause in your tests suites after a failure. It is a break time really appreciated for investigating the problem through the web browser. For enabling this mode, you need the --debug PHPUnit option without the headless mode:

$ PANTHER_NO_HEADLESS=1 bin/phpunit --debug

Test 'App\AdminTest::testLogin' started
Error: something is wrong.

Press enter to continue...

To use the interactive mode, the PHPUnit extension must be registered.

Using an External Web Server

Sometimes, it's convenient to reuse an existing web server configuration instead of starting the built-in PHP one. To do so, set the external_base_uri option:

<?php

namespace App\Tests;

use Symfony\Component\Panther\PantherTestCase;

class E2eTest extends PantherTestCase
{
    public function testMyApp(): void
    {
        $pantherClient = static::createPantherClient(['external_base_uri' => 'https://localhost']);
        // the PHP integrated web server will not be started
    }
}

Having a Multi-domain Application

It happens that your PHP/Symfony application might serve several different domain names.

As Panther saves the Client in memory between tests to improve performances, you will have to run your tests in separate processes if you write several tests using Panther for different domain names.

To do so, you can use the native @runInSeparateProcess PHPUnit annotation.

ℹ Note: it is really convenient to use the external_base_uri option and start your own webserver in the background, because Panther will not have to start and stop your server on each test. Symfony CLI can be a quick and easy way to do so.

Here is an example using the external_base_uri option to determine the domain name used by the Client:

<?php

namespace App\Tests;

use Symfony\Component\Panther\PantherTestCase;

class FirstDomainTest extends PantherTestCase
{
    /**
     * @runInSeparateProcess
     */
    public function testMyApp(): void
    {
        $pantherClient = static::createPantherClient([
            'external_base_uri' => 'http://mydomain.localhost:8000',
        ]);
        
        // Your tests
    }
}
<?php

namespace App\Tests;

use Symfony\Component\Panther\PantherTestCase;

class SecondDomainTest extends PantherTestCase
{
    /**
     * @runInSeparateProcess
     */
    public function testMyApp(): void
    {
        $pantherClient = static::createPantherClient([
            'external_base_uri' => 'http://anotherdomain.localhost:8000',
        ]);
        
        // Your tests
    }
}

Using a Proxy

To use a proxy server, set the following environment variable: PANTHER_CHROME_ARGUMENTS='--proxy-server=socks://127.0.0.1:9050'

Accepting Self-signed SSL Certificates

To force Chrome to accept invalid and self-signed certificates, set the following environment variable: PANTHER_CHROME_ARGUMENTS='--ignore-certificate-errors' This option is insecure, use it only for testing in development environments, never in production (e.g. for web crawlers).

For Firefox, instantiate the client like this:

$client = Client::createFirefoxClient(null, null, ['capabilities' => ['acceptInsecureCerts' => true]]);

Docker Integration

Here is a minimal Docker image that can run Panther with both Chrome and Firefox:

FROM php:alpine

# Chromium and ChromeDriver
ENV PANTHER_NO_SANDBOX 1
# Not mandatory, but recommended
ENV PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage'
RUN apk add --no-cache chromium chromium-chromedriver

# Firefox and GeckoDriver (optional)
ARG GECKODRIVER_VERSION=0.28.0
RUN apk add --no-cache firefox libzip-dev; \
    docker-php-ext-install zip
RUN wget -q https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz; \
    tar -zxf geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/bin; \
    rm geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz

Build it with docker build . -t myproject Run it with docker run -it -v "$PWD":/srv/myproject -w /srv/myproject myproject bin/phpunit

GitHub Actions Integration

Panther works out of the box with GitHub Actions. Here is a minimal .github/workflows/panther.yml file to run Panther tests:

name: Run Panther tests

on: [ push, pull_request ]

jobs:
  tests:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Install dependencies
        run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

      - name: Run test suite
        run: bin/phpunit

Travis CI Integration

Panther will work out of the box with Travis CI if you add the Chrome addon. Here is a minimal .travis.yml file to run Panther tests:

language: php
addons:
  # If you don't use Chrome, or Firefox, remove the corresponding line
  chrome: stable
  firefox: latest

php:
  - 8.0

script:
  - bin/phpunit

Gitlab CI Integration

Here is a minimal .gitlab-ci.yml file to run Panther tests with Gitlab CI:

image: ubuntu

before_script:
  - apt-get update
  - apt-get install software-properties-common -y
  - ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
  - apt-get install curl wget php php-cli php7.4 php7.4-common php7.4-curl php7.4-intl php7.4-xml php7.4-opcache php7.4-mbstring php7.4-zip libfontconfig1 fontconfig libxrender-dev libfreetype6 libxrender1 zlib1g-dev xvfb chromium-chromedriver firefox-geckodriver -y -qq
  - export PANTHER_NO_SANDBOX=1
  - export PANTHER_WEB_SERVER_PORT=9080
  - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  - php composer-setup.php --install-dir=/usr/local/bin --filename=composer
  - php -r "unlink('composer-setup.php');"
  - composer install

test:
  script:
    - bin/phpunit

AppVeyor Integration

Panther will work out of the box with AppVeyor as long as Google Chrome is installed. Here is a minimal appveyor.yml file to run Panther tests:

build: false
platform: x86
clone_folder: c:\projects\myproject

cache:
  - '%LOCALAPPDATA%\Composer\files'

install:
  - ps: Set-Service wuauserv -StartupType Manual
  - cinst -y php composer googlechrome chromedriver firfox selenium-gecko-driver
  - refreshenv
  - cd c:\tools\php80
  - copy php.ini-production php.ini /Y
  - echo date.timezone="UTC" >> php.ini
  - echo extension_dir=ext >> php.ini
  - echo extension=php_openssl.dll >> php.ini
  - echo extension=php_mbstring.dll >> php.ini
  - echo extension=php_curl.dll >> php.ini
  - echo memory_limit=3G >> php.ini
  - cd %APPVEYOR_BUILD_FOLDER%
  - composer install --no-interaction --no-progress

test_script:
  - cd %APPVEYOR_BUILD_FOLDER%
  - php bin\phpunit

Usage with Other Testing Tools

If you want to use Panther with other testing tools like LiipFunctionalTestBundle or if you just need to use a different base class, Panther has got you covered. It provides you with the Symfony\Component\Panther\PantherTestCaseTrait and you can use it to enhance your existing test-infrastructure with some Panther awesomeness:

<?php

namespace App\Tests\Controller;

use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\Panther\PantherTestCaseTrait;

class DefaultControllerTest extends WebTestCase
{
    use PantherTestCaseTrait; // this is the magic. Panther is now available.

    public function testWithFixtures(): void
    {
        $this->loadFixtures([]); // load your fixtures
        $client = self::createPantherClient(); // create your panther client

        $client->request('GET', '/');
    }
}

Limitations

The following features are not currently supported:

  • Crawling XML documents (only HTML is supported)
  • Updating existing documents (browsers are mostly used to consume data, not to create webpages)
  • Setting form values using the multidimensional PHP array syntax
  • Methods returning an instance of \DOMElement (because this library uses WebDriverElement internally)
  • Selecting invalid choices in select

Pull Requests are welcome to fill the remaining gaps!

Troubleshooting

Run with Bootstrap 5

If you are using Bootstrap 5, then you may have a problem with testing. Bootstrap 5 implements a scrolling effect, which tends to mislead Panther.

To fix this, we advise you to deactivate this effect by setting the Bootstrap 5 $enable-smooth-scroll variable to false in your style file.

$enable-smooth-scroll: false;

Save the Panthers

Many of the wild cat species are highly threatened. If you like this software, help save the (real) panthers by donating to the Panthera organization.

Credits

Created by Kévin Dunglas. Sponsored by Les-Tilleuls.coop.

Panther is built on top of PHP WebDriver and several other FOSS libraries. It has been inspired by Nightwatch.js, a WebDriver-based testing tool for JavaScript.

More Repositories

1

symfony

The Symfony PHP framework
PHP
28,665
star
2

console

Eases the creation of beautiful and testable command line interfaces
PHP
9,560
star
3

http-foundation

Defines an object-oriented layer for the HTTP specification
PHP
8,513
star
4

event-dispatcher

Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
PHP
8,393
star
5

finder

Finds files and directories via an intuitive fluent interface
PHP
8,290
star
6

http-kernel

Provides a structured process for converting a Request into a Response
PHP
7,980
star
7

thanks

Give thanks (in the form of a GitHub ★) to your fellow PHP package maintainers (not limited to Symfony components)!
PHP
7,912
star
8

polyfill-mbstring

This component provides a partial, native PHP implementation for the Mbstring extension.
PHP
7,746
star
9

routing

Maps an HTTP request to a set of configuration variables
PHP
7,477
star
10

debug

Provides tools to ease debugging PHP code
PHP
7,312
star
11

css-selector

Converts CSS selectors to XPath expressions
PHP
7,309
star
12

process

Executes commands in sub-processes
PHP
7,302
star
13

var-dumper

Provides mechanisms for walking through any arbitrary PHP variable
PHP
7,278
star
14

translation

Provides tools to internationalize your application
PHP
6,529
star
15

polyfill-php72

This component provides functions added to PHP 7.2 core.
PHP
4,756
star
16

filesystem

Provides basic utilities for the filesystem
PHP
4,500
star
17

config

Helps you find, load, combine, autofill and validate configuration values of any kind
PHP
4,138
star
18

flex

Composer plugin for Symfony
PHP
4,043
star
19

dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application
PHP
4,011
star
20

cache

Provides extended PSR-6, PSR-16 (and tags) implementations
PHP
3,977
star
21

polyfill-ctype

This component provides a partial, native PHP implementation for the Ctype extension.
PHP
3,966
star
22

dom-crawler

Eases DOM navigation for HTML and XML documents
PHP
3,834
star
23

yaml

Loads and dumps YAML files
PHP
3,693
star
24

contracts

A set of abstractions extracted out of the Symfony components
PHP
3,607
star
25

dotenv

Registers environment variables from a .env file
PHP
3,604
star
26

framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework
PHP
3,402
star
27

maker-bundle

Symfony Maker Bundle
PHP
3,317
star
28

polyfill-php70

This component provides features unavailable in releases prior to PHP 7.0.
3,243
star
29

polyfill-intl-idn

This component provides a partial, native PHP implementation for the Intl extension (IDN features).
PHP
3,163
star
30

event-dispatcher-contracts

A set of event dispatcher abstractions extracted out of the Symfony components
PHP
3,146
star
31

doctrine-bridge

Provides integration for Doctrine with various Symfony components
PHP
3,086
star
32

options-resolver

Provides an improved replacement for the array_replace PHP function
PHP
3,074
star
33

asset

Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
PHP
3,046
star
34

browser-kit

Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
PHP
2,849
star
35

monolog-bundle

Symfony Monolog Bundle
PHP
2,817
star
36

expression-language

Provides an engine that can compile and evaluate expressions
PHP
2,709
star
37

stopwatch

Provides a way to profile code
PHP
2,692
star
38

property-access

Provides functions to read and write from/to an object or array using a simple string notation
PHP
2,677
star
39

form

Allows to easily create, process and reuse HTML forms
PHP
2,663
star
40

error-handler

Provides tools to manage errors and ease debugging PHP code
PHP
2,577
star
41

mime

Allows manipulating MIME messages
PHP
2,576
star
42

intl

Provides access to the localization data of the ICU library
PHP
2,560
star
43

polyfill-intl-icu

This component provides a collection of functions/classes using the symfony/intl package when the Intl extension is not installed.
PHP
2,537
star
44

validator

Provides tools to validate values
PHP
2,515
star
45

monolog-bridge

Provides integration for Monolog with various Symfony components
PHP
2,512
star
46

polyfill

PHP polyfills
PHP
2,468
star
47

twig-bridge

Provides integration for Twig with various Symfony components
PHP
2,416
star
48

twig-bundle

Provides a tight integration of Twig into the Symfony full-stack framework
PHP
2,412
star
49

phpunit-bridge

Provides utilities for PHPUnit, especially user deprecation notices management
PHP
2,398
star
50

security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework
PHP
2,374
star
51

service-contracts

A set of service abstractions extracted out of the Symfony components
PHP
2,369
star
52

polyfill-php73

This component provides functions unavailable in releases prior to PHP 7.3.
PHP
2,367
star
53

translation-contracts

A set of translation abstractions extracted out of the Symfony components
PHP
2,362
star
54

serializer

Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
PHP
2,358
star
55

demo

Symfony Demo Application
PHP
2,345
star
56

debug-bundle

Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework
PHP
2,277
star
57

inflector

Converts words between their singular and plural forms (English only)
PHP
2,227
star
58

webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
JavaScript
2,225
star
59

cache-contracts

A set of cache abstractions extracted out of the Symfony components
PHP
2,149
star
60

web-profiler-bundle

Provides a development tool that gives detailed information about the execution of any request
Twig
2,147
star
61

property-info

Extracts information about PHP class' properties using metadata of popular sources
PHP
2,079
star
62

symfony-docs

The Symfony documentation
HTML
2,077
star
63

var-exporter

Allows exporting any serializable PHP data structure to plain PHP code
PHP
1,916
star
64

polyfill-intl-normalizer

This component provides a fallback implementation for the Normalizer class provided by the Intl extension.
PHP
1,840
star
65

orm-pack

A Symfony Pack for Doctrine ORM
1,839
star
66

http-client-contracts

A set of HTTP client abstractions extracted out of the Symfony components
PHP
1,770
star
67

http-client

Provides powerful methods to fetch HTTP resources synchronously or asynchronously
PHP
1,763
star
68

polyfill-iconv

This component provides a native PHP implementation of the php.net/iconv functions.
PHP
1,757
star
69

deprecation-contracts

A generic function and convention to trigger deprecation notices
PHP
1,751
star
70

security-core

Symfony Security Component - Core Library
PHP
1,734
star
71

profiler-pack

A Symfony Pack for Symfony profiler
1,716
star
72

security-csrf

Symfony Security Component - CSRF Library
PHP
1,652
star
73

security-http

Symfony Security Component - HTTP Integration
PHP
1,580
star
74

polyfill-php80

This component provides functions unavailable in releases prior to PHP 8.0.
PHP
1,576
star
75

swiftmailer-bundle

Symfony Swiftmailer Bundle
PHP
1,571
star
76

polyfill-php56

This component provides functions unavailable in releases prior to PHP 5.6.
1,557
star
77

polyfill-intl-grapheme

This component provides a partial, native PHP implementation of the Grapheme functions from the Intl extension.
PHP
1,512
star
78

symfony-standard

The "Symfony Standard Edition" distribution
PHP
1,501
star
79

debug-pack

A Symfony Pack for Symfony debug
1,498
star
80

string

Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
PHP
1,447
star
81

security-guard

Symfony Security Component - Guard
PHP
1,434
star
82

polyfill-util

This component provides binary-safe string functions, using the mbstring extension when available.
PHP
1,338
star
83

web-link

Manages links between resources
PHP
1,333
star
84

web-server-bundle

Provides commands for running applications using the PHP built-in web server
PHP
1,280
star
85

mailer

Helps sending emails
PHP
1,263
star
86

psr-http-message-bridge

PSR HTTP message bridge
PHP
1,209
star
87

security

Provides a complete security system for your web application
PHP
1,203
star
88

class-loader

[DEPRECATED] The ClassLoader component provides tools to autoload your classes and cache their locations for performance.
PHP
1,109
star
89

serializer-pack

A Symfony Pack for Symfony Serializer
1,075
star
90

templating

Provides all the tools needed to build any kind of template system
PHP
1,021
star
91

webpack-encore-bundle

Symfony integration with Webpack Encore!
PHP
929
star
92

lts

Enforces Long Term Supported versions of Symfony components
924
star
93

messenger

Helps applications send and receive messages to/from other applications or via message queues
PHP
923
star
94

apache-pack

A Symfony Pack for Symfony Apache
913
star
95

recipes

Symfony Recipes Repository
PHP
908
star
96

test-pack

A Symfony Pack for functional testing
866
star
97

polyfill-php81

This component provides functions unavailable in releases prior to PHP 8.1.
PHP
764
star
98

proxy-manager-bridge

Provides integration for ProxyManager with various Symfony components
PHP
724
star
99

notifier

Sends notifications via one or more channels (email, SMS, ...)
PHP
673
star
100

polyfill-apcu

This component provides apcu_* functions and the APCUIterator class to users of the legacy APC extension.
PHP
635
star