enjoys / forms-yandex-smartcaptcha
Yandex SmartCaptcha for enjoys/forms
1.0.1
2025-06-20 12:25 UTC
Requires
- php: ~8.1.0 | ~8.2.0 | ~8.3.0 | ~8.4.0
- enjoys/forms: ^5.5
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- enjoys/dotenv: ^3.1
- guzzlehttp/guzzle: ^7.5
- infection/infection: ^0.29
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.6
- symfony/var-dumper: ^5.4 | ^6.0 | ^7.0
This package is auto-updated.
Last update: 2025-06-20 12:29:09 UTC
README
addon for enjoys/forms
Run built-in server for view example
php -S localhost:8000 -t ./example .route
Usage
// ...before code // Required. Set ID for form. $form->setAttribute(AttributeFactory::create('id', uniqid())); // or new Form(id: uniqid()) // or $form->setId(uniqid()) // Init YandexSmartCaptcha $captcha = new YandexSmartCaptcha($Psr18_HttpClient, $Psr7RequestFactory, $Psr7StreamFactory); $captcha // ->setPublicKey('...') ->setPrivateKey('...') ->setWidgetOptions( // Optional. Full options new WidgetOptions( hl: Language::RU, // Language enum or as string 'en' or null (default - null) callback: 'myCallback', // string or null (default - null) invisible: false, // bool or null (default - null) shieldPosition: ShieldPosition::CENTER_LEFT, // only with invisible. ShieldPosition enum or string or null (default - null) hideShield: false, // only with invisible. bool or null (default - null) webview: false, //bool or null (default - null) test: true // bool or null (default - null) ) );