PHPackages                             timatanga/headless - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. timatanga/headless

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

timatanga/headless
==================

The timatanga Headless package. Browser automation with chrome/chromium in headless mode

v0.1.0(4y ago)00MITPHPPHP ^8.0

Since Sep 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/timatanga/headless)[ Packagist](https://packagist.org/packages/timatanga/headless)[ RSS](/packages/timatanga-headless/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Headless
========

[](#headless)

This package provides a fluent interface for browser automation. It is heavily influenced by Laravel Dusk so all credits go to Taylor Otwell and his amazing team for there incredible work and inspiration! Instead of installing JDK or Selenium, this package requires and uses a standalone ChromeDriver.

Installation
------------

[](#installation)

To get started, you should install Google Chrome on your system. Google Chrome will be managed in headless mode via this package through the ChromeDriver.

Please make use of composer to install this package

```
composer require dbisapps/headless

```

Instead of relying on Laravel's artisan command line interface to install the ChromeDriver this package supports a static method to get the driver installed within the package directory:

```
use dbizapps\Headless\Browser;

$result = Browser::install();

```

The required ChromeDriver version is detected based on the major version of the installed Chrome/Chromium browser on your machine.

Browser Navigation
------------------

[](#browser-navigation)

The Headless packages provides an easy to use, fluent interface to concat browser operations. Navigation operations all return the browser instance itself.

A good starting point is to visit a page by:

```
use dbizapps\Headless\Browser;

$browser = new Browser;

$browser->visit('laravel.com');

```

Other available navigation operations are:

```
// browse to the blank page.
$browser->blank();

// refresh the page
$browser->refresh();

// navigate back
$browser->back();

// navigate back
$browser->forward();

```

Browser Sizing &amp; Moving
---------------------------

[](#browser-sizing--moving)

Even in headless mode with non-visible operations, it is sometimes useful for further operations to adjust the browser size

```
// maximize browser window
$browser->maximize();

// resize browser window
$browser->resize($width, $height);

// make the browser window as large as the content.
$browser->fitContent();

// Move the browser window.
$browser->move($x, $y);

```

Page
----

[](#page)

Just visiting a page isn't that useful. A useful browser automation needs to interact with page elements.

Interacting with page form elements is enabled after visiting a page

```
// Click on link with the given selector, e.g. #submit
$browser->click($selector);

// Press on button with the given selector
$browser->press($selector);

// Get (just passing the selector) or set value (passing selector and value) of element with the given selector.
$browser->value($selector, $value);

// Get text of element with the given selector
$browser->text($selector);

// Clear selected element and type value
$browser->type($selector, $value);

// Append value to element with given selector
$browser->append($selector, $value);

// Clear the given field
$browser->clear($selector);

// Select the given value of element with given selector
$browser->select($selector, $value);

// Select radio option
$browser->radio($selector, $value);

// Check the given checkbox.
$browser->check($selector, $value);

// Uncheck the given checkbox.
$browser->uncheck($selector, $value);

```

Dialog interactions are supported as well

```
// Accept a JavaScript dialog.
$browser->acceptDialog();

// DismissDialog a JavaScript dialog.
$browser->dismissDialog();

// Type the given value in an open JavaScript prompt dialog.
$browser->typeInDialog($value);

```

Execute Scripts
---------------

[](#execute-scripts)

If you need to extend existing scripts with custom javascripts just use:

```
// Execute JavaScript within the browser.
$browser->script($script);

```

Assertions
----------

[](#assertions)

For automated browser interactions you may want to assert that a specific content is on the page.

```
// Assert that the page title matches the given text.
$browser->assertTitle($title);

// Assert that the page title contains the given text.
$browser->assertTitleContains($text);

// Assert that the given text is present on the page.
$browser->assertSee($text);

// Assert that the given text is not present on the page.
$browser->assertDontSee($text);

// Assert that the given text is present within the selector.
$browser->assertSeeIn($selector, $value);

// Assert that the given text is not present within the selector.
$browser->assertDontSeeIn($selector, $value);

// Assert that the given link is present on the page.
$browser->assertSeeLink($link);

// Assert that the given link is not present on the page.
$browser->assertDontSeeLink($link);

// Assert that the given input field does not have the given value.
$browser->assertInputValue($field, $value);

// Assert that the given input field does not have the given value.
$browser->assertInputValueIsNot($field, $value);

// Assert that the given checkbox is checked.
$browser->assertChecked($field, $value);

// Assert that the given checkbox is not checked.
$browser->assertNotChecked($field, $value);

// Assert that the given radio field is selected.
$browser->assertRadioSelected($field, $value);

// Assert that the given radio field is not selected.
$browser->assertRadioNotSelected($field, $value);

// Assert that the given dropdown has the given value selected.
$browser->assertSelected($field, $value);

// Assert that the given dropdown does not have the given value selected.
$browser->assertNotSelected($field, $value);

// Assert that the given array of values are available to be selected.
$browser->assertSelectHasOptions($field, $values);

// Assert that the given array of values are not available to be selected.
$browser->assertSelectMissingOptions($field, $values);

```

... and many more. Please refer to the SupportAssertions Trait for details.

Get Messages, Content or Outputs
--------------------------------

[](#get-messages-content-or-outputs)

Headless browser operations require feedback to be useful at any kind. From computed messages, console logs to page source or page caputures are numerous browser operations available:

```
// Preserve computed or returned messages
$arr = $browser->getMessages()

// set html source into browser
$page = $browser->setHtml($html)

// returns html page dump
$page = $browser->getPage()

// dump html page to disk
$path = $browser->savePage($filename)

// takes a screen capture, stores as image
$path = $browser->screenshot($filename)

// takes a screen (visible screen) capture, stores as image
$path = $browser->screenshot($filename)

// takes a page (viewport) capture, stores as image
$path = $browser->pageshot($filename)

// dumps the console log to disk
$path = $browser->consoleLog($filename)

```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1682d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e85d042af6c9730c747e158b2b03e6876ebc03b3d2bdf5e3fe5e55fe4f6e6b2?d=identicon)[dbizapps](/maintainers/dbizapps)

---

Tags

webdriverheadlesschromium

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/timatanga-headless/health.svg)

```
[![Health](https://phpackages.com/badges/timatanga-headless/health.svg)](https://phpackages.com/packages/timatanga-headless)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M561](/packages/symfony-maker-bundle)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M255](/packages/laravel-dusk)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M81](/packages/symplify-monorepo-builder)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.6k4.5M63](/packages/chrome-php-chrome)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
