Download the PHP package druidfi/symfony-altcha-bundle without Composer

On this page you can find all versions of the php package druidfi/symfony-altcha-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-altcha-bundle

Altcha CAPTCHA integration

Altcha is a privacy-friendly, self-hostable CAPTCHA. This integration supports both self-hosted (proof-of-work, no external calls) and Sentinel/cloud (server-side verification via Altcha's API) modes.

Files

File Purpose
src/Service/AltchaService.php Core logic: create challenges, verify solutions
src/Controller/AltchaChallengeController.php GET /altcha/challenge endpoint (self-hosted mode)
src/Form/Type/AltchaType.php Symfony form type — renders the widget and applies validation
src/Validator/AltchaValid.php Constraint attribute
src/Validator/AltchaValidValidator.php Constraint validator — calls AltchaService::verify()
templates/altcha_form.html.twig Twig block that renders the <altcha-widget> element
public/js/altcha.js Vendored Altcha widget JS (used in self-hosted mode)
public/js/altcha-i18n.js Finnish (fi) and Swedish (sv) translations for the widget

Environment variables

All variables are defined in .env. Override them per environment in .env.local / .env.prod etc.

Variable Default Description
ALTCHA_HMAC_KEY dev-only-hmac-key-change-in-production HMAC secret for signing challenges. Must be changed in production.
ALTCHA_ENABLED (empty) Set to false or 0 to disable CAPTCHA validation entirely. Useful in test/dev environments.
ALTCHA_COST 50000 PBKDF2 iteration count for proof-of-work challenges. Higher = harder for bots, slower for users.
ALTCHA_SENTINEL_URL (empty) Set to enable Sentinel/cloud mode. Challenge URL handed to the widget.
ALTCHA_SENTINEL_VERIFY_URL (empty) Optional override for the Sentinel verify endpoint. Derived from ALTCHA_SENTINEL_URL if omitted.
ALTCHA_SENTINEL_API_KEY (empty) API key for the Sentinel verify call (if required by your Sentinel plan).
ALTCHA_HIDE_FOOTER true Hide the "Powered by Altcha" footer in the widget.
ALTCHA_HIDE_LOGO true Hide the Altcha logo in the widget.
ALTCHA_SCRIPT_URL /js/altcha.js URL to the Altcha widget JS. Use /js/altcha.js for the vendored local copy or a CDN URL.
ALTCHA_AUTO (empty) Auto-solve mode: onload (invisible, solves on page load), onsubmit (solves on form submit), or empty for manual checkbox (default).
ALTCHA_FLOATING (empty) Set to true or 1 to show the widget as a floating badge instead of an inline element.

Modes

Self-hosted (default)

All three ALTCHA_SENTINEL_* variables are empty. The widget fetches a challenge from /altcha/challenge, solves it client-side using proof-of-work (PBKDF2), and submits the solution in a hidden form field. The server verifies the HMAC signature locally — no external calls.

Sentinel / cloud

Set ALTCHA_SENTINEL_URL to your Sentinel challenge URL (e.g. https://eu.altcha.org/api/v1/challenge?apiKey=xxx). The widget uses this URL directly. On form submit, the server calls the Sentinel verify endpoint instead of doing local HMAC verification.

ALTCHA_SENTINEL_VERIFY_URL is optional — if omitted, the verify URL is derived from ALTCHA_SENTINEL_URL by replacing the path with /api/v1/verify/signature.

Usage in a form

Add the field to any Symfony form class:

The form type renders the widget via templates/altcha_form.html.twig and automatically attaches an AltchaValid constraint. No extra configuration is needed.

To show the floating badge style on a specific form, pass the floating option:

This overrides ALTCHA_FLOATING for that field only.

Translations

The Altcha widget bundles only English. public/js/altcha-i18n.js registers Finnish (fi) and Swedish (sv) translations via globalThis.$altcha?.i18n.set(), which the widget picks up reactively.

The widget resolves the display language in order: language attribute on <altcha-widget> → document.documentElement.lang → navigator.languages. The <html lang="{{ app.request.locale }}"> attribute in base.html.twig provides the locale automatically.

To add another language, append a translation object to altcha-i18n.js and call globalThis.$altcha?.i18n.set('<locale>', obj). See the existing fi/sv objects for the full list of required keys.

Updating the vendored JS

The file public/js/altcha.js is a vendored copy of the Altcha widget. To update it, replace it with the latest altcha.js from the Altcha releases or from npm (altcha package, dist/main/altcha.js), then set ALTCHA_SCRIPT_URL=/js/altcha.js.


All versions of symfony-altcha-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
altcha-org/altcha Version ^2.0
symfony/dependency-injection Version ^7.0|^8.0
symfony/form Version ^7.0|^8.0
symfony/framework-bundle Version ^7.0|^8.0
symfony/http-foundation Version ^7.0|^8.0
symfony/http-kernel Version ^7.0|^8.0
symfony/routing Version ^7.0|^8.0
symfony/validator Version ^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package druidfi/symfony-altcha-bundle contains the following files

Loading the files please wait ...