dazza-dev / laravel-captcha-solver
Laravel implementation of anti-captcha.com, capsolver.com and capmonster.cloud
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/dazza-dev/laravel-captcha-solver
Requires
- php: >=8.0
- dazza-dev/captcha-solver: ^1.0
README
This package provides a simple and convenient way to solve captchas using different services.
Supported Services
anticaptcha- api.anti-captcha.comcapmonster- api.capmonster.cloudcapsolver- api.capsolver.com
Installation
composer require dazza-dev/laravel-captcha-solver
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="DazzaDev\LaravelCaptchaSolver\CaptchaSolverServiceProvider" --tag=captcha-solver-config
Add environment variables to .env:
CAPTCHA_SOLVER_SERVICE=anticaptcha # or capmonster, capsolver CAPTCHA_SOLVER_API_KEY=your-api-key-here
Usage
Using Facade
use DazzaDev\LaravelCaptchaSolver\Facades\CaptchaSolver; // Optional: set service and API key at runtime CaptchaSolver::setService('capsolver')->setApiKey('your-api-key-here'); // Get balance $balance = CaptchaSolver::getBalance(); // Solve reCaptcha V2 $solutionV2 = CaptchaSolver::solveReCaptchaV2('https://site.example', 'site-key-v2'); // Solve reCaptcha V3 $solutionV3 = CaptchaSolver::solveReCaptchaV3('https://site.example', 'site-key-v3');
Dependency Injection
use DazzaDev\LaravelCaptchaSolver\CaptchaSolverManager; class ExampleController { private CaptchaSolverManager $solver; public function __construct(CaptchaSolverManager $solver) { $this->solver = $solver; } public function solve(): string { // Optional: set service and API key at runtime $this->solver->setService('anticaptcha')->setApiKey('your-api-key-here'); return $this->solver->solveReCaptchaV2('https://site.example', 'site-key-v2') ?? ''; } }
Notes
- The provider auto-registers and reads
captcha-solver.phpconfig keys. - Use the specific tag
captcha-solver-configto publish only this package's config.
Contributions
Contributions are welcome. If you find any bugs or have ideas for improvements, please open an issue or send a pull request. Make sure to follow the contribution guidelines.
Author
Laravel Captcha Solver was created by DAZZA.
License
This project is licensed under the MIT License.