PHPackages                             brenoleite8/capsolver-php - 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. [API Development](/categories/api)
4. /
5. brenoleite8/capsolver-php

ActiveLibrary[API Development](/categories/api)

brenoleite8/capsolver-php
=========================

PHP package for easy integration with CapSolver API

028PHP

Since May 27Pushed 1y agoCompare

[ Source](https://github.com/brenoleite8/capsolver-php)[ Packagist](https://packagist.org/packages/brenoleite8/capsolver-php)[ RSS](/packages/brenoleite8-capsolver-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Module for CapSolver API
============================

[](#php-module-for-capsolver-api)

The easiest way to quickly integrate \[CapSolver\] captcha solving service into your code to automate solving of any types of captcha.

- ❗ An API key it's **required**. [**Get here.**](https://dashboard.capsolver.com/passport/register?inviteCode=CHhA_5os)

[![](https://camo.githubusercontent.com/ec83d9d8223955ce4ea0529c04349542290520ac30d01e24b614dd96ed81489c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d646f63732e636170736f6c7665722e636f6d2d626c7565)](https://docs.capsolver.com/guide/getting-started.html)

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

[](#installation)

This package can be installed via composer or manually

### Composer

[](#composer)

```
composer require brenoleite8/capsolver-php:dev-master

```

### Manual

[](#manual)

Copy `src` directory to your project and then `require` autoloader (`src/autoloader.php`) where needed:

```
require 'path/to/autoloader.php';
```

Configuration
-------------

[](#configuration)

`CapSolver` instance can be created like this:

```
$solver = new \CapSolver\CapSolver('CAI-XXX...');
```

Also there are few options that can be configured:

```
$solver = new \CapSolver\CapSolver([
    'apiKey'           => 'CAI-XXX...',
    'defaultTimeout'   => 120,
    'recaptchaTimeout' => 600,
    'pollingInterval'  => 10,
]);
```

### CapSolver instance options

[](#capsolver-instance-options)

OptionDefault valueDescriptiondefaultTimeout120Polling timeout in seconds for all captcha types except ReCaptcha. Defines how long the module tries to get the answer from `getTaskResult` API endpointrecaptchaTimeout600Polling timeout for ReCaptcha in seconds. Defines how long the module tries to get the answer from `getTaskResult` API endpointpollingInterval10Interval in seconds between requests to `getTaskResult` API endpoint, setting values less than 5 seconds is not recommended> To get the answer manually use [getResult method](#send--getresult)

Solve a captcha
---------------

[](#solve-a-captcha)

### Call example

[](#call-example)

Use this method to solve ReCaptcha V2 and obtain a token to bypass the protection.

```
$result = $solver->recaptchav2([
        'websiteKey'    => 'XxX-XXXXXXxXXXXXXXXXXxXXXXX',                   // grab it from target site
        'websiteURL'    => 'https://www.mysite.com/recaptcha/api2/demo',    // grab it from target site
        'proxy'         => 'proxy.provider.io:23331:user1:password1',       // proxy string format
]);
```

Manual polling
--------------

[](#manual-polling)

### send / getResult

[](#send--getresult)

These methods can be used for manual captcha submission and answer polling.

```
$id = $solver->send(['type' => 'HCaptchaTask', ...]);
sleep(20);

$code = $solver->getResult($id);
```

### balance

[](#balance)

Use this method to get your account's balance

```
$balance = $solver->balance();
```

Error handling
--------------

[](#error-handling)

If case of an error captcha solver throws an exception. It's important to properly handle these cases. We recommend to use `try catch` to handle exceptions.

```
try {
    $result = $solver->recaptchav2([
            'websiteKey'    => 'XxX-XXXXXXxXXXXXXXXXXxXXXXX',                   // grab it from target site
            'websiteURL'    => 'https://www.mysite.com/recaptcha/api2/demo',    // grab it from target site
            'proxy'         => 'proxy.provider.io:23331:user1:password1',       // proxy string format
    ]);
} catch (\CapSolver\Exception\ValidationException $e) {
    // invalid parameters passed
} catch (\CapSolver\Exception\NetworkException $e) {
    // network error occurred
} catch (\CapSolver\Exception\ApiException $e) {
    // api respond with error
} catch (\CapSolver\Exception\TimeoutException $e) {
    // captcha is not solved so far
}
```

📁 Examples directory
--------------------

[](#-examples-directory)

**Figure out all the working examples [here](https://github.com/0qwertyy/capsolver-php/tree/master/examples).**\[CapSolver\]:

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/71729212?v=4)[Breno Leite](/maintainers/brenoleite8)[@brenoleite8](https://github.com/brenoleite8)

---

Top Contributors

[![brenoleite8](https://avatars.githubusercontent.com/u/71729212?v=4)](https://github.com/brenoleite8 "brenoleite8 (2 commits)")

### Embed Badge

![Health badge](/badges/brenoleite8-capsolver-php/health.svg)

```
[![Health](https://phpackages.com/badges/brenoleite8-capsolver-php/health.svg)](https://phpackages.com/packages/brenoleite8-capsolver-php)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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