Skip to content

Commit

Permalink
Merge pull request #16 from njoguamos/version-2
Browse files Browse the repository at this point in the history
Drop Laravel 9 and php 8.0
  • Loading branch information
njoguamos authored Feb 11, 2024
2 parents 6970918 + 7b1f73c commit 1f240e6
Show file tree
Hide file tree
Showing 13 changed files with 2,916 additions and 1,456 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: ['8.0', 8.1, 8.2 ]
laravel: [ 9.*, 10.* ]
php: [ 8.1, 8.2 , '8.3']
laravel: [ 10.* ]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
testbench: ^8.21
carbon: ^2.63
- laravel: 9.*
testbench: 7.*
carbon: ^2.63
exclude:
- laravel: 10.*
php: 8.0

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down Expand Up @@ -56,4 +50,4 @@ jobs:
run: composer show -D

- name: Execute tests
run: vendor/bin/pest --verbose
run: vendor/bin/pest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ coverage
build
.fleet
.DS_Store
.phpunit.cache
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![Cover image](/cover.png)
# Cloudflare Turnstile for Laravel 8+
# Cloudflare Turnstile for Laravel 10+

[![Latest Version on Packagist](https://img.shields.io/packagist/v/njoguamos/laravel-turnstile.svg?style=flat-square)](https://packagist.org/packages/njoguamos/laravel-turnstile)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/njoguamos/laravel-turnstile/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/njoguamos/laravel-turnstile/actions?query=workflow%3Arun-tests+branch%3Amain)
Expand All @@ -11,6 +11,13 @@
>**Info**
> This package focuses on server side validation. You are free to implement your preferable client side technology such vue, reach, blade e.t.c
## Version compatibility

| Version | PHP versions | Laravel versions |
|---------|:-----------------|------------------|
| 1.x.x | 8.0, 8.1 and 8.2 | 9.x and 10.x |
| 2.x.x | 8.1, 8.2 and 8.3 | 10.x |

## Installation

You can install the package via composer:
Expand Down Expand Up @@ -66,9 +73,26 @@ Ensure your client side technology submit a turnstile token using a name defined

Upon submitting the form, the turnstile token will be validated against turnstile api. If it fails, the request will be redirected back with `status` message. You can handle this message however you want in client side.

### 2. As a validation rule
```text
@TODO: Working on it
### 2. As a validation rule (v2.x.x)

You can user the inbuilt validation to validate form input

```php
use NjoguAmos\Turnstile\Rules\TurnstileRule;

class RegisterRequest extends FormRequest
{
/** @return array<string, array> */
public function rules(): array
{
return [
# Other fields
'token' => ['required', new TurnstileRule() ],
];
}

# Other code
}
```

### 3. Manual
Expand Down
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@
}
],
"require": {
"php": "^8.0 | ^8.1 | ^8.2",
"php": "^8.1 | ^8.2 | ^8.3",
"guzzlehttp/guzzle": "^7.5",
"illuminate/support": "^9.0 | ^10.0",
"illuminate/contracts": "^10.0",
"spatie/laravel-package-tools": "^1.13.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^6.0 | ^7.0 | ^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"nunomaduro/collision": "^7.0",
"larastan/larastan": "^2.8.1",
"orchestra/testbench": "^8.2",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^v2.2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
"phpstan/phpstan-phpunit": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 1f240e6

Please sign in to comment.