PHPackages                             browserbase/stagehand - 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. browserbase/stagehand

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

browserbase/stagehand
=====================

Stagehand PHP SDK

v3.21.0(1mo ago)71.3k↑152%[1 PRs](https://github.com/browserbase/stagehand-php/pulls)MITPHPPHP ^8.1CI passing

Since Dec 16Pushed 3w agoCompare

[ Source](https://github.com/browserbase/stagehand-php)[ Packagist](https://packagist.org/packages/browserbase/stagehand)[ RSS](/packages/browserbase-stagehand/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (57)Versions (38)Used By (0)

 [   ![Stagehand](https://raw.githubusercontent.com/browserbase/stagehand/main/media/light_logo.png)  ](https://stagehand.dev)

 **The AI Browser Automation Framework**

 [   ![MIT License](https://raw.githubusercontent.com/browserbase/stagehand/main/media/light_license.svg)  ](https://github.com/browserbase/stagehand/tree/main?tab=MIT-1-ov-file#MIT-1-ov-file) [   ![Discord Community](https://raw.githubusercontent.com/browserbase/stagehand/main/media/light_discord.svg)  ](https://stagehand.dev/discord)

 [![browserbase%2Fstagehand | Trendshift](https://camo.githubusercontent.com/fe5be433cdcfa76089ddd24502990521a24a8e6b19304464fd7975b961c0a9aa/68747470733a2f2f7472656e6473686966742e696f2f6170692f62616467652f7265706f7369746f726965732f3132313232)](https://trendshift.io/repositories/12122)

If you're looking for other languages, you can find them [ here](https://docs.stagehand.dev/v3/first-steps/introduction)

 **Vibe code**  Stagehand with  [ Director ](https://director.ai)    ![Director](https://raw.githubusercontent.com/browserbase/stagehand/main/media/director_icon.svg)

What is Stagehand?
------------------

[](#what-is-stagehand)

Stagehand is a browser automation framework used to control web browsers with natural language and code. By combining the power of AI with the precision of code, Stagehand makes web automation flexible, maintainable, and actually reliable.

Why Stagehand?
--------------

[](#why-stagehand)

Most existing browser automation tools either require you to write low-level code in a framework like Selenium, Playwright, or Puppeteer, or use high-level agents that can be unpredictable in production. By letting developers choose what to write in code vs. natural language (and bridging the gap between the two) Stagehand is the natural choice for browser automations in production.

1. **Choose when to write code vs. natural language**: use AI when you want to navigate unfamiliar pages, and use code when you know exactly what you want to do.
2. **Go from AI-driven to repeatable workflows**: Stagehand lets you preview AI actions before running them, and also helps you easily cache repeatable actions to save time and tokens.
3. **Write once, run forever**: Stagehand's auto-caching combined with self-healing remembers previous actions, runs without LLM inference, and knows when to involve AI whenever the website changes and your automation breaks.

Stagehand PHP API library
=========================

[](#stagehand-php-api-library)

The Stagehand PHP library provides convenient access to the Stagehand REST API from any PHP 8.1.0+ application.

It is generated with [Stainless](https://www.stainless.com/).

Documentation
-------------

[](#documentation)

The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev).

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

[](#installation)

```
composer require "browserbase/stagehand 3.21.0"

```

Usage
-----

[](#usage)

This library uses named parameters to specify optional arguments. Parameters with a default value must be set by name.

Here's a comprehensive example demonstrating the full workflow: start session, navigate, observe, act, extract, execute agent, and end session.

```
