Skip to main content

Upgrading to 2.0 from 1.x

This guide will assist you in migrating your Laravel Captcha from version 1.x to version 2.0.

Required Versions

The required versions for software dependencies have been updated:

  • PHP's minimum required version is now v8.0.
  • Laravel's minimum required version is now v8.0.0.

Dependency Updates

You'll need to update the Laravel Captcha dependency in your application's composer.json file:

-   "rahul900day/laravel-captcha": "^1.2"
+ "rahul900day/laravel-captcha": "^2.0"

Blade Directives Updates

Beginning from version 2.0, Laravel Captcha transitions from Blade directives to Laravel Blade components. All current Blade directives should be replaced with respective components.

-   @captcha_js
+ <x-captcha-js />
-   @captcha_container
+ <x-captcha-container />

Captcha Driver Update (optional)

Laravel Captcha 2.0 introduces an updated driver resolution technique. Although not required, developers are encouraged to update their current captcha driver names for better synchronization.

note

Legacy driver names are still supported and can be utilized without issues.

Previously Supported Drivers

  • turnstile
  • hCaptcha
  • reCaptcha

Newly Supported Drivers

  • turnstile
  • hcaptcha
  • recaptcha

Update the driver names accordingly. This change is minor and primarily serves to unify the naming convention across the library's configurations.