Skip to content

Commit

Permalink
Laravel 9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienheyd committed Mar 15, 2022
1 parent 440b2e4 commit 0a1eb05
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 10,372 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ vendor
composer.lock
composer.phar
src/node_modules
.phpunit.result.cache
src/package-lock.json
.phpunit.result.cache
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0

cache:
directories:
- $HOME/.composer/cache
- $HOME/.cache/composer

before_script:
- phpenv config-rm xdebug.ini
- composer self-update
- COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-source --no-interaction
- COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction --no-progress

script:
- vendor/bin/phpcs
- vendor/bin/phpunit

branches:
only:
- master
10 changes: 5 additions & 5 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Sebastien HEYD
Copyright (c) 2017 Sébastien HEYD <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ test: vendor phpunit.xml ## Unit testing
clean: ## Remove files needed for tests
rm -rf ./vendor
rm -f ./composer.phar
rm -f ./composer.lock
rm -f ./composer.lock
rm -f .phpunit.result.cache
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Fully hidden captcha for Laravel without reCaptcha

[![Packagist](https://img.shields.io/packagist/v/sebastienheyd/hidden-captcha.svg?style=flat-square)](https://packagist.org/packages/sebastienheyd/hidden-captcha)
[![Packagist](https://img.shields.io/packagist/v/sebastienheyd/hidden-captcha?style=flat-square)](https://packagist.org/packages/sebastienheyd/hidden-captcha)
[![Build Status](https://travis-ci.org/sebastienheyd/hidden-captcha.svg?branch=master)](https://travis-ci.org/sebastienheyd/hidden-captcha)
[![StyleCI](https://github.styleci.io/repos/51009111/shield?branch=master)](https://github.styleci.io/repos/51009111)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sebastienheyd/hidden-captcha/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sebastienheyd/hidden-captcha/?branch=master)
![Laravel](https://img.shields.io/badge/Laravel-5.x%20→%208.x-green?logo=Laravel&style=flat-square)
![Nb downloads](https://img.shields.io/packagist/dt/sebastienheyd/hidden-captcha.svg)
[![MIT License](https://img.shields.io/github/license/sebastienheyd/hidden-captcha?style=flat-square)](license.md)
[![Laravel](https://img.shields.io/badge/Laravel-5.x%20→%209.x-green?logo=Laravel&style=flat-square)](https://laravel.com/)
[![Nb downloads](https://img.shields.io/packagist/dt/sebastienheyd/hidden-captcha.svg)](https://packagist.org/packages/sebastienheyd/hidden-captcha)
[![MIT License](https://img.shields.io/github/license/sebastienheyd/hidden-captcha?style=flat-square)](LICENSE)

Fully hidden spam protection solution for Laravel without reCaptcha. Based on several strategies to block the vast
majority of spam bots without interfering with the user experience.
Expand All @@ -30,7 +30,7 @@ composer require sebastienheyd/hidden-captcha
Publish public assets :

```
php artisan vendor:publish --provider="SebastienHeyd\HiddenCaptcha\HiddenCaptchaServiceProvider" --tag=public
php artisan vendor:publish --tag=laravel-assets
```

Extra steps for Laravel < 5.5 :
Expand Down Expand Up @@ -64,25 +64,30 @@ These limits can be changed by declaring them in the validation rule, for exampl

`$rules = ['captcha' => 'hiddencaptcha:5,2400'];`

## Package update
You can also publish the configuration file to edit the default time limits :

```
php artisan vendor:publish --tag=captcha-config
```

## Package update (Laravel < 8.6.9)

Hidden-captcha comes with a JS who must be publish. Since you typically will need to overwrite the assets
every time the package is updated, you may use the ```--force``` flag :

```
php artisan vendor:publish --provider="SebastienHeyd\HiddenCaptcha\HiddenCaptchaServiceProvider" --tag=public --force
php artisan vendor:publish --tag=laravel-assets --force
```

To auto update assets each time package is updated, you can add this command to `post-autoload-dump` into the
To auto update assets each time package is updated, you can add this command to `post-update-cmd` into the
file `composer.json` at the root of your project.


```json
{
"scripts": {
"post-autoload-dump": [
"@php artisan vendor:publish --provider=\"SebastienHeyd\\HiddenCaptcha\\HiddenCaptchaServiceProvider\" --tag=public --force -q",
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --force --ansi"
]
}
}
```
```
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"require": {
"php" : ">=5.6.4",
"ext-json": "*",
"laravel/framework": "^5.4|^6.0|^7.0|^8.0"
"laravel/framework": "^5.4|^6.0|^7.0|^8.0|^9.0"
},
"require-dev": {
"php" : ">=5.6.4",
"phpunit/phpunit": "^5.0|^6.0|^7.0|^8.0",
"phpunit/phpunit": "^8.0|^9.0",
"squizlabs/php_codesniffer": "^3.0",
"orchestra/testbench": "^3.0|^4.0"
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0",
"doctrine/dbal": "^2.9"
},
"extra": {
"laravel": {
Expand Down
4 changes: 2 additions & 2 deletions src/HiddenCaptchaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function ($attribute, $value, $parameters, $validator) {
$this->loadViewsFrom(__DIR__.'/views', 'hiddenCaptcha');
$this->loadRoutesFrom(__DIR__.'/routes/hidden-captcha.php');

$this->publishes([__DIR__.'/public' => public_path()], 'public');
$this->publishes([__DIR__.'/config' => config_path()], 'config');
$this->publishes([__DIR__.'/public' => public_path()], ['public', 'laravel-assets']);
$this->publishes([__DIR__.'/config' => config_path()], 'captcha-config');
}

/**
Expand Down
Loading

0 comments on commit 0a1eb05

Please sign in to comment.