Skip to content

Commit 22e5bd3

Browse files
authored
[3.x] Added Laravel 11 Support (#23)
1 parent df65a1e commit 22e5bd3

File tree

9 files changed

+36
-98
lines changed

9 files changed

+36
-98
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
strategy:
1414
fail-fast: true
1515
matrix:
16-
php: ['8.0', 8.1, 8.2, 8.3]
17-
laravel: [8, 9, 10]
16+
php: [8.1, 8.2, 8.3]
17+
laravel: [10, 11]
1818
exclude:
19-
- php: 8.0
20-
laravel: 10
19+
- php: 8.1
20+
laravel: 11
2121

2222
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
2323

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.idea
22
.phpunit.result.cache
3+
.phpunit.cache
34
build
45
composer.lock
56
coverage

UPGRADE.md

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,19 @@
11
# Upgrade Guide
22

3-
## Upgrading to 2.0 from 1.x
3+
## Upgrading to 3.0 from 2.x
44

55
### Minimum Versions
66

77
The following requirement has been updated:
88

9-
- The minimum PHP version is now `v8.0`
10-
- The minimum Laravel version is now `v8.0.0`
9+
- The minimum PHP version is now `v8.1`
10+
- The minimum Laravel version is now `v10.0.0`
1111

1212
### Updating Dependencies
1313

1414
You should update the following dependency in your application's `composer.json` file:
1515

1616
```diff
17-
- "rahul900day/laravel-captcha": "^1.2"
18-
+ "rahul900day/laravel-captcha": "^2.0"
17+
- "rahul900day/laravel-captcha": "^2.0"
18+
+ "rahul900day/laravel-captcha": "^3.0"
1919
```
20-
21-
### Updating blade directives
22-
23-
From version 2 onwards we moved from blade directives to [laravel components](https://laravel.com/docs/10.x/blade#components),
24-
so replace all of your blade directives with components.
25-
26-
```diff
27-
- @captcha_js
28-
+ <x-captcha-js />
29-
```
30-
31-
```diff
32-
- @captcha_container
33-
+ <x-captcha-container />
34-
```
35-
36-
### Updating captcha driver (optional)
37-
38-
So we have updated our diver resolution technique, so we encourage developers to update there captcha driver names.
39-
40-
> **[NOTE]** Previous diver names are fine, you can still use it as it is.
41-
42-
#### Previously supported divers
43-
44-
- turnstile
45-
- hCaptcha
46-
- reCaptcha
47-
48-
#### Currently supported drivers
49-
50-
- turnstile
51-
- hcaptcha
52-
- recaptcha

composer.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.0",
21-
"guzzlehttp/guzzle": "^6.5.5|^7.0.1",
22-
"illuminate/http": "^8.0|^9.0|^10.0",
23-
"illuminate/support": "^8.0|^9.0|^10.0",
24-
"illuminate/validation": "^8.0|^9.0|^10.0",
25-
"illuminate/view": "^8.0|^9.0|^10.0"
20+
"php": "^8.1",
21+
"guzzlehttp/guzzle": "^7.5",
22+
"illuminate/http": "^10.0|^11.0",
23+
"illuminate/support": "^10.0|^11.0",
24+
"illuminate/validation": "^10.0|^11.0",
25+
"illuminate/view": "^10.0|^11.0"
2626
},
2727
"require-dev": {
2828
"laravel/pint": "^1.5.0",
29-
"nunomaduro/collision": "^5.10|^6.0|^7.0",
30-
"orchestra/testbench": "^6.0|^7.0|^8.0",
31-
"pestphp/pest": "^1.21",
32-
"pestphp/pest-plugin-laravel": "^1.2",
33-
"phpunit/phpunit": "^9.5",
34-
"rector/rector": "^0.18.4",
35-
"spatie/pest-plugin-snapshots": "^1.0"
29+
"nunomaduro/collision": "^7.0|^8.0",
30+
"orchestra/testbench": "^8.0|^9.0",
31+
"pestphp/pest": "^2.0",
32+
"rector/rector": "^1.0"
3633
},
3734
"autoload": {
3835
"psr-4": {

phpunit.xml.dist

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnFailure="false"
14-
executionOrder="random"
15-
failOnWarning="true"
16-
failOnRisky="true"
17-
failOnEmptyTestSuite="true"
18-
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
20-
>
21-
<testsuites>
22-
<testsuite name="VendorName Test Suite">
23-
<directory suffix=".php">./tests/</directory>
24-
</testsuite>
25-
</testsuites>
26-
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
30-
<report>
31-
<html outputDirectory="build/coverage"/>
32-
<text outputFile="build/coverage.txt"/>
33-
<clover outputFile="build/logs/clover.xml"/>
34-
</report>
35-
</coverage>
36-
<logging>
37-
<junit outputFile="build/report.junit.xml"/>
38-
</logging>
2+
<phpunit colors="true">
3+
<testsuites>
4+
<testsuite name="Default Test Suite">
5+
<directory suffix=".php">./tests/</directory>
6+
</testsuite>
7+
</testsuites>
8+
<source>
9+
<include>
10+
<directory suffix=".php">./src</directory>
11+
</include>
12+
</source>
3913
</phpunit>

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
]);
2020

2121
$rectorConfig->sets([
22-
LevelSetList::UP_TO_PHP_80,
22+
LevelSetList::UP_TO_PHP_81,
2323
SetList::CODE_QUALITY,
2424
SetList::DEAD_CODE,
2525
SetList::EARLY_RETURN,

src/CaptchaServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ class CaptchaServiceProvider extends ServiceProvider
1717
{
1818
public function register(): void
1919
{
20-
$this->mergeConfigFrom(__DIR__.'/../config/captcha.php', 'captcha');
20+
if (! app()->configurationIsCached()) {
21+
$this->mergeConfigFrom(__DIR__.'/../config/captcha.php', 'captcha');
22+
}
2123

2224
$this->app->singleton(CaptchaContract::class, fn ($app): CaptchaManager => new CaptchaManager($app));
2325

src/Views/Components/Js.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99

1010
class Js extends Component
1111
{
12-
public ?string $lang;
13-
14-
public function __construct(?string $lang = null)
12+
public function __construct(public ?string $lang = null)
1513
{
16-
$this->lang = $lang;
1714
}
1815

1916
public function render(): string

0 commit comments

Comments
 (0)