PHPackages                             yaknet/yacaptcha - 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. [Security](/categories/security)
4. /
5. yaknet/yacaptcha

ActiveLibrary[Security](/categories/security)

yaknet/yacaptcha
================

Official PHP SDK for YakNet yaCaptcha (Altcha-based) &amp; WAF integration.

1.4.0(1mo ago)026MITPHPPHP ^8.2

Since Jul 11Pushed 1mo agoCompare

[ Source](https://github.com/y-packages/yacaptcha)[ Packagist](https://packagist.org/packages/yaknet/yacaptcha)[ RSS](/packages/yaknet-yacaptcha/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (11)Used By (0)

YakNet yaCaptcha Client SDK (`yaknet/yacaptcha`)
================================================

[](#yaknet-yacaptcha-client-sdk-yaknetyacaptcha)

Official PHP integration SDK for the **YakNet yaCaptcha (Altcha-based) Protection Platform** (`auth.yakhub.com.tr`). This library provides a simple and secure PHP interface for displaying and verifying captchas without external dependencies like Guzzle (using native PHP cURL).

---

Requirements
------------

[](#requirements)

- PHP `>= 8.2`
- `ext-curl` enabled
- `ext-json` enabled

---

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

[](#installation)

You can install this package using Composer:

```
composer require yaknet/yacaptcha
```

*(Note: Ensure your repository is configured to access the private or custom packagist endpoint if this library is self-hosted, or install via local path repository).*

---

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

[](#configuration)

Copy the `.env.example` variables to your application's `.env` file and set your credentials:

```
YACAPTCHA_CLIENT_ID="your-client-id-here"
YACAPTCHA_CLIENT_SECRET="your-client-secret-here"
YACAPTCHA_BASE_URL="https://auth.yakhub.com.tr"
```

---

Basic Usage
-----------

[](#basic-usage)

### 1. Render the yaCaptcha Widget

[](#1-render-the-yacaptcha-widget)

To display the captcha on your form page, generate the widget HTML and load the required JavaScript module:

```
use YakNet\YaCaptcha\YaCaptcha;

// Initialize the client using environment variables
$yaCaptcha = new YaCaptcha(
    getenv('YACAPTCHA_CLIENT_ID') ?: '',
    getenv('YACAPTCHA_CLIENT_SECRET') ?: '',
    getenv('YACAPTCHA_BASE_URL') ?: 'https://auth.yakhub.com.tr'
);

// Render the widget script tag (typically loaded in head or footer)
echo $yaCaptcha->getScriptTag();
?>

    Submit

```

#### Customizing Widget Attributes

[](#customizing-widget-attributes)

You can pass custom challenge URLs and HTML attributes:

```
echo $yaCaptcha->getWidgetHtml('', [
    'auto' => 'onfocus',         // Options: 'onload', 'onfocus', 'off'
    'hideogo' => 'true',         // Hide the Altcha/yaCaptcha logo
    'class' => 'my-custom-class' // Custom CSS class for styling
]);
```

---

### 2. Verify the Captcha on Submit

[](#2-verify-the-captcha-on-submit)

When the user submits the form, the widget attaches a parameter named `altcha` containing the solution payload. Verify this payload in your backend script:

```
use YakNet\YaCaptcha\YaCaptcha;

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $payload = $_POST['altcha'] ?? '';

    $yaCaptcha = new YaCaptcha(
        getenv('YACAPTCHA_CLIENT_ID') ?: '',
        getenv('YACAPTCHA_CLIENT_SECRET') ?: '',
        getenv('YACAPTCHA_BASE_URL') ?: 'https://auth.yakhub.com.tr'
    );

    // Verify the payload with YakNet Auth server
    if ($yaCaptcha->verify($payload)) {
        // Captcha validation success! Proceed with form action
        echo "Validation successful! Processing form...";
    } else {
        // Captcha validation failed! Reject the request
        http_response_code(400);
        echo "Captcha validation failed. Please try again.";
        exit;
    }
}
```

---

Testing
-------

[](#testing)

Run unit tests via PHPUnit:

```
vendor/bin/phpunit
```

Run static code analysis via PHPStan:

```
vendor/bin/phpstan analyse
```

---

License
-------

[](#license)

This project is developed by **YakNet Bilişim** and licensed under the **MIT License**.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance92

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~1 days

Total

10

Last Release

39d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/236650944?v=4)[yakistir98](/maintainers/yakistir98)[@yakistir98](https://github.com/yakistir98)

---

Top Contributors

[![yaknetbilisim](https://avatars.githubusercontent.com/u/242705004?v=4)](https://github.com/yaknetbilisim "yaknetbilisim (10 commits)")

---

Tags

securitycaptchabot-protectionALTCHAyaknetyacaptcha

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yaknet-yacaptcha/health.svg)

```
[![Health](https://phpackages.com/badges/yaknet-yacaptcha/health.svg)](https://phpackages.com/packages/yaknet-yacaptcha)
```

###  Alternatives

[gregwar/captcha-bundle

Captcha bundle

3525.0M37](/packages/gregwar-captcha-bundle)[s1syphos/php-simple-captcha

Simple captcha generator

2743.5k15](/packages/s1syphos-php-simple-captcha)[bbysaeth/typo3-altcha

TYPO3 form element for spam protection by utilizing the proof-of-work mechanism Altcha.

1230.5k1](/packages/bbysaeth-typo3-altcha)[lorddashme/php-simple-captcha

A simple captcha package that fit to any type of web application built on php.

103.0k](/packages/lorddashme-php-simple-captcha)

PHPackages © 2026

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