Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit c8a9432

Browse files
committed
Update Laravel version to 11.x and PHP version to 8.2, adjust workflow and configuration files accordingly
1 parent 7083f50 commit c8a9432

File tree

7 files changed

+25
-28
lines changed

7 files changed

+25
-28
lines changed

.github/workflows/run-tests-l10.yml renamed to .github/workflows/run-tests-l11.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: "Run Tests - Laravel 10"
1+
name: "Run Tests - Laravel 11"
22

33
on:
44
push:
5-
branches: [ v5.x, master ]
5+
branches: [ v6.x, master ]
66

77
pull_request:
8-
branches: [ v5.x, master ]
8+
branches: [ v6.x, master ]
99

1010
jobs:
1111
tests:
@@ -26,11 +26,11 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
php: [ 8.1 ]
30-
laravel: [ 10.* ]
29+
php: [ 8.2 ]
30+
laravel: [ 11.* ]
3131
include:
32-
- laravel: 10.*
33-
testbench: 10.*
32+
- laravel: 11.*
33+
testbench: 11.*
3434

3535
name: P${{ matrix.php }} - L${{ matrix.laravel }}
3636

.phprc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
php8.1
1+
php8.2

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A MongoDB session driver for Laravel
44

55
| **Laravel<br/>Version** | **Package<br/>Version** | **Install using<br/>this command** |
66
|-------------------------|-------------------------|---------------------------------------------------|
7+
| 11.x | 6.x.x | composer require 1ff/laravel-mongodb-session:^6.0 |
78
| 10.x | 5.x.x | composer require 1ff/laravel-mongodb-session:^5.0 |
89
| 9.x | 4.x.x | composer require 1ff/laravel-mongodb-session:^4.0 |
910
| 8.x | 3.x.x | composer require 1ff/laravel-mongodb-session:^3.0 |

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"description": "A mongodb session driver for laravel",
44
"type": "library",
55
"require": {
6-
"php": "^8.1",
7-
"illuminate/session": "^10.0",
6+
"php": "^8.2",
7+
"illuminate/session": "^11.0",
88
"mongodb/laravel-mongodb": "^5.0",
99
"ext-mongodb": "*"
1010
},
1111
"require-dev": {
12-
"phpunit/phpunit": "^10.0",
13-
"orchestra/testbench": "^8.0"
12+
"phpunit/phpunit": "^11.0",
13+
"orchestra/testbench": "^9.0"
1414
},
1515
"license": "MIT",
1616
"authors": [
@@ -42,6 +42,6 @@
4242
}
4343
},
4444
"scripts": {
45-
"test": "vendor/bin/phpunit"
45+
"test": "$(head -1 .phprc) ./vendor/bin/phpunit"
4646
}
4747
}

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
colors="true"
77
processIsolation="false"
88
stopOnFailure="false"
9-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
1010
cacheDirectory=".phpunit.cache"
1111
backupStaticProperties="false"
1212
>
@@ -24,4 +24,4 @@
2424
<env name="MONGODB_PORT" value="27017"/>
2525
<env name="MONGODB_DATABASE" value="laravel_session_test"/>
2626
</php>
27-
</phpunit>
27+
</phpunit>

src/MongoDbSessionHandler.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22

33
namespace ForFit\Session;
44

5+
use Illuminate\Database\ConnectionInterface;
6+
use Illuminate\Database\Query\Builder;
57
use MongoDB\BSON\Binary;
68
use MongoDB\BSON\UTCDateTime;
79
use MongoDB\Driver\Exception\BulkWriteException;
810
use SessionHandlerInterface;
911

1012
class MongoDbSessionHandler implements SessionHandlerInterface
1113
{
12-
protected $connection;
13-
protected $minutes;
14-
protected $table;
14+
protected ConnectionInterface $connection;
15+
protected int $minutes;
16+
protected string $table;
1517

16-
/**
17-
* @param \Illuminate\Database\ConnectionInterface $connection
18-
* @param string $table
19-
* @param integer $minutes
20-
*/
21-
public function __construct($connection, $table = 'sessions', $minutes = 60)
18+
public function __construct(ConnectionInterface $connection, string $table = 'sessions', int $minutes = 60)
2219
{
2320
$this->connection = $connection;
2421
$this->minutes = (int)$minutes;
@@ -89,7 +86,7 @@ public function gc($max_lifetime): false|int
8986
* Returns the query builder
9087
*
9188
*/
92-
protected function query()
89+
protected function query(): Builder
9390
{
9491
return $this->connection->table($this->table);
9592
}
@@ -100,7 +97,7 @@ protected function query()
10097
* @param string|null $data
10198
* @return array
10299
*/
103-
protected function buildPayload($data)
100+
protected function buildPayload($data): array
104101
{
105102
return [
106103
'payload' => new Binary($data, Binary::TYPE_OLD_BINARY),

src/SessionServiceProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ class SessionServiceProvider extends ParentServiceProvider
1313
* Register any application services.
1414
*
1515
* @throws \Exception
16-
* @return void
1716
*
1817
*/
19-
public function boot()
18+
public function boot(): void
2019
{
2120
if (config('session.driver') !== 'mongodb') {
2221
return;

0 commit comments

Comments
 (0)