I had a problem with the keys, that were stored in the .env file. The keys were retrieved in your Captcha Code on two positions (e.g. anam/captcha/src/Captcha.php) by means of the env() function.
Everything worked as described until I fired up
php artisan config:cache.
From then on, the app told me that the site_key or secret key was missing. This could be fixed by using
php artisan config:clear.
However, according to the laravel documentation (https://laravel.com/docs/5.5/helpers#method-env) there is a problem when using the env() function in other files than the config file in combination with the config caching feature. In that case the function will return null.
Hence I would suggest to write a short config file load the keys from .env using the env() function and use the config() helper within your classes to get the keys from there.
That worked for me. So I can use the cached and non-cached config.
Hi and thanks for the nice wrapper,
I had a problem with the keys, that were stored in the .env file. The keys were retrieved in your Captcha Code on two positions (e.g. anam/captcha/src/Captcha.php) by means of the env() function. Everything worked as described until I fired up
php artisan config:cache
.From then on, the app told me that the site_key or secret key was missing. This could be fixed by using
php artisan config:clear
.However, according to the laravel documentation (https://laravel.com/docs/5.5/helpers#method-env) there is a problem when using the env() function in other files than the config file in combination with the config caching feature. In that case the function will return null.
Hence I would suggest to write a short config file load the keys from .env using the env() function and use the config() helper within your classes to get the keys from there.
That worked for me. So I can use the cached and non-cached config.
Best regards
speedy
Config example, with google test keys: captcha.php.zip