Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Added Laravel 11 #23

Merged
merged 8 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ['8.0', 8.1, 8.2, 8.3]
laravel: [8, 9, 10]
php: [8.1, 8.2, 8.3]
laravel: [10, 11]
exclude:
- php: 8.0
laravel: 10
- php: 8.1
laravel: 11

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

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea
.phpunit.result.cache
.phpunit.cache
build
composer.lock
coverage
Expand Down
43 changes: 5 additions & 38 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,19 @@
# Upgrade Guide

## Upgrading to 2.0 from 1.x
## Upgrading to 3.0 from 2.x

### Minimum Versions

The following requirement has been updated:

- The minimum PHP version is now `v8.0`
- The minimum Laravel version is now `v8.0.0`
- The minimum PHP version is now `v8.1`
- The minimum Laravel version is now `v10.0.0`

### Updating Dependencies

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

```diff
- "rahul900day/laravel-captcha": "^1.2"
+ "rahul900day/laravel-captcha": "^2.0"
- "rahul900day/laravel-captcha": "^2.0"
+ "rahul900day/laravel-captcha": "^3.0"
```

### Updating blade directives

From version 2 onwards we moved from blade directives to [laravel components](https://laravel.com/docs/10.x/blade#components),
so replace all of your blade directives with components.

```diff
- @captcha_js
+ <x-captcha-js />
```

```diff
- @captcha_container
+ <x-captcha-container />
```

### Updating captcha driver (optional)

So we have updated our diver resolution technique, so we encourage developers to update there captcha driver names.

> **[NOTE]** Previous diver names are fine, you can still use it as it is.

#### Previously supported divers

- turnstile
- hCaptcha
- reCaptcha

#### Currently supported drivers

- turnstile
- hcaptcha
- recaptcha
23 changes: 10 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@
}
],
"require": {
"php": "^8.0",
"guzzlehttp/guzzle": "^6.5.5|^7.0.1",
"illuminate/http": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0",
"illuminate/validation": "^8.0|^9.0|^10.0",
"illuminate/view": "^8.0|^9.0|^10.0"
"php": "^8.1",
"guzzlehttp/guzzle": "^7.5",
"illuminate/http": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/validation": "^10.0|^11.0",
"illuminate/view": "^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.5.0",
"nunomaduro/collision": "^5.10|^6.0|^7.0",
"orchestra/testbench": "^6.0|^7.0|^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.2",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.18.4",
"spatie/pest-plugin-snapshots": "^1.0"
"nunomaduro/collision": "^7.0|^8.0",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.0",
"rector/rector": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
48 changes: 11 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="VendorName Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit colors="true">
<testsuites>
<testsuite name="Default Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
Expand Down
4 changes: 3 additions & 1 deletion src/CaptchaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class CaptchaServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/captcha.php', 'captcha');
if (! app()->configurationIsCached()) {
$this->mergeConfigFrom(__DIR__.'/../config/captcha.php', 'captcha');
}

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

Expand Down
5 changes: 1 addition & 4 deletions src/Views/Components/Js.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class Js extends Component
{
public ?string $lang;

public function __construct(?string $lang = null)
public function __construct(public ?string $lang = null)
{
$this->lang = $lang;
}

public function render(): string
Expand Down
Loading