Download the PHP package phox/browser-agent without Composer

On this page you can find all versions of the php package phox/browser-agent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package browser-agent

phox/browser-agent

Probably the fastest goal-driven browser agent for PHP.

Give it a URL and a goal in plain language. It drives a remote Chrome over the Chrome DevTools Protocol, picks each action from the controls on the page in front of it, and returns what it did, evidence of what it found, and the page's console errors and failed requests.

It runs against any CDP endpoint. Cloudflare Browser Run is the tested host: several processes can share one warm browser session, each in its own browser context.

Usage

Decisions go to TypeSafe's /v1/systemone by default. OpenRouter answers the same request at its own path with an OpenRouter key: new ModelConfig(typesafeKey: $openRouterKey, typesafeBaseUrl: ModelConfig::OPENROUTER_BASE_URL, decisionPath: ModelConfig::OPENROUTER_DECISION_PATH).

A run is read-only unless AgentOptions sets readOnly: false: it may click to navigate or reveal, but is offered nothing that types, selects or submits. A run ends done, blocked (with reason not_found or stuck), budget or off_site. Script::of($state) records what it did and Replayer plays that back without the model.

PageReader::readDocument() reads the whole rendered page, with an outline of its headings, to give a model the page as context, and TextRendering::of($observation) turns an observation into that text. A document reading is cut so its rendering fits max_document characters, keeping headings, then controls, then text, and nothing can be acted on from it.

BrowserTab::open(..., keepOpen: true) leaves the page open when the connection goes. BrowserTab::attach($connection, $targetId) picks it up again, and Agent::run() without a url works on it where it is, with goals, queries (new AgentOptions([], $queries)) or both.

Queries are the caller's JavaScript, run in the reader's isolated world: they see the DOM but not page globals, and el(node) returns the element behind a node number from the latest observation, as listed in Report::of and the text rendering.

Requirements

Development

Tests run offline and never call a browser host or a model API. The Browser suite drives a local headless Chrome, found in the Puppeteer cache or through CHROME_PATH; skip it with vendor/bin/pest --testsuite=Unit.

tools/run.php runs one goal against a real endpoint and real models and prints the report. tools/soak.php runs hundreds of transport and reader calls against a real endpoint such as Browser Run and reports latency and every failure. It costs browser time, so it is not a test.

The page reader is JavaScript in reader/src, bundled into resources/page-reader.js, which is committed so the package installs without Node. Rebuild and test it in a local headless Chrome:

npm test finds chrome-headless-shell in the Puppeteer cache, or uses CHROME_PATH.

Licence

MIT


All versions of browser-agent with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
amphp/websocket-client Version ^2.0
guzzlehttp/guzzle Version ^7.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phox/browser-agent contains the following files

Loading the files please wait ...