contao-components/altcha
Customized ALTCHA script packaged for integration with Contao Open Source CMS, providing a drop-in way to use ALTCHA within Contao installations.
Form::onSubmit) contrasts with Laravel’s route/controller model. ALTCHA’s validation logic would need rewrapping for Laravel’s request lifecycle.{{ Altcha::render() }}), requiring a Laravel service provider to expose ALTCHA’s assets.public function validateAltcha(Request $request) {
$validator = new \ContaoComponents\AltchaBundle\Validator\AltchaValidator();
return $validator->validate($request->input('altcha_response'));
}
AltchaWidget) would need Laravel bindings:
$this->app->bind(\ContaoComponents\AltchaBundle\Widget\AltchaWidget::class, function () {
return new \ContaoComponents\AltchaBundle\Widget\AltchaWidget(config('altcha.site_key'));
});
// resources/js/app.js
import altchaScript from 'contao-components/altcha/dist/altcha.js';
Route::post('/altcha/validate', [AltchaController::class, 'validate']);
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Architecture Mismatch | High | Abstract Contao-specific logic into a Laravel-agnostic layer (e.g., separate validation service). |
| Session Conflicts | Medium | Configure ALTCHA to use Laravel’s session driver or cookie-based tokens. |
| Asset Loading | Medium | Use Laravel Mix/Vite to bundle ALTCHA’s JS/CSS; test with asset optimization. |
| Validation Logic | High | Extensively test with Laravel’s Form Request validation and middleware. |
| Performance | Low | ALTCHA is lightweight, but Laravel’s queue system may be needed for high-traffic forms. |
| Maintenance Overhead | High | Plan for forking the package or rewriting Contao-specific components. |
MockHttp or Testing traits)?spatie/laravel-honeypot or mewebstudio/captcha) that better fit Laravel’s ecosystem?core-bundle is a hard dependency. This is a red flag for Laravel projects.laravel-captcha, haskin/laravel-captcha), making ALTCHA a non-ideal choice unless Contao interoperability is required.<script src="{{ asset('vendor/contao-components/altcha/dist/altcha.js') }}"></script>
tl_form, tl_article comments) that would need rewriting.// resources/views/contact.blade.php
{!! Altcha::render() !!}
use ContaoComponents\AltchaBundle\Validator\AltchaValidator;
public function submitContact(Request $request) {
$validator = new AltchaValidator();
if (!$validator->validate($request->input('altcha_response'))) {
return back()->withErrors(['captcha' => 'Invalid CAPTCHA']);
}
// Process form...
}
ValidatedRequest).'captcha' => 'required|string|min:3|max:10',
| Component | Compatibility Notes |
|---|---|
| Laravel Middleware | ALTCHA’s validation must be wrapped in Laravel middleware or Form Requests. |
| Blade Templates | ALTCHA’s HTML/JS must be embedded in Blade views (no Contao template system). |
| Session Handling | ALTCHA defaults to PHP sessions; configure Laravel’s session driver (e.g., file, redis). |
| Asset Pipeline | ALTCHA’s JS/CSS must be published via Laravel Mix or manually linked. |
| Validation |
How can I help you explore Laravel packages today?