Skip to content

Commit 2cb65ca

Browse files
committed
feat: add Laravel 12 support and fix Laravel 7 compatibility
- Add Laravel 12.x to test matrix - Fix Laravel 7 Encrypter initialization (no cipher parameter needed) - Update README and source docs for Laravel 7-12 support - Adjust PHP version selection for Laravel 10+
1 parent 0245a66 commit 2cb65ca

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ jobs:
7575
strategy:
7676
fail-fast: false
7777
matrix:
78-
laravel: [7, 8, 9, 10, 11]
78+
laravel: [7, 8, 9, 10, 11, 12]
7979

8080
steps:
8181
- uses: actions/checkout@v4
8282

8383
- name: Setup PHP
8484
uses: shivammathur/setup-php@v2
8585
with:
86-
php-version: ${{ matrix.laravel == 7 && '7.4' || matrix.laravel == 8 && '8.0' || matrix.laravel == 9 && '8.1' || '8.3' }}
86+
php-version: ${{ matrix.laravel == 7 && '7.4' || matrix.laravel == 8 && '8.0' || matrix.laravel == 9 && '8.1' || matrix.laravel >= 10 && '8.3' }}
8787
extensions: mbstring, xml, json
8888

8989
- name: Setup Node.js
@@ -109,7 +109,13 @@ jobs:
109109
require 'vendor/autoload.php';
110110
111111
$key = base64_decode(getenv('TEST_KEY'));
112-
$encrypter = new \Illuminate\Encryption\Encrypter($key, 'aes-256-cbc');
112+
// Laravel 7 requires key to be passed differently
113+
$laravel_version = getenv('LARAVEL_VERSION');
114+
if ($laravel_version == '7') {
115+
$encrypter = new \Illuminate\Encryption\Encrypter($key);
116+
} else {
117+
$encrypter = new \Illuminate\Encryption\Encrypter($key, 'aes-256-cbc');
118+
}
113119
114120
// All test cases - verschiedene Datentypen!
115121
$testCases = [

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Laravel-compatible encryption/decryption for Node.js. Fully compatible with Lara
88

99
## Features
1010

11-
- ✅ 100% Laravel compatible (7.x - 11.x)
11+
- ✅ 100% Laravel compatible (7.x - 12.x)
1212
- ✅ Zero configuration (auto-detects `APP_KEY`)
1313
- ✅ AES-256-CBC encryption with HMAC-SHA256
1414
- ✅ No dependencies (optional `php-serialize` for complex objects)
@@ -109,6 +109,7 @@ app.post('/decrypt', (req, res) => {
109109

110110
| Laravel | Node.js | PHP | Status |
111111
|---------|---------|--------|--------|
112+
| 12.x | 18+ | 8.3+ ||
112113
| 11.x | 18+ | 8.2+ ||
113114
| 10.x | 16+ | 8.1+ ||
114115
| 9.x | 14+ | 8.0+ ||

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ const crypto = require('crypto');
22

33
/**
44
* Laravel-compatible Encryption class for Node.js
5-
* Full compatibility with Laravel 7.x through 11.x
5+
* Full compatibility with Laravel 7.x through 12.x
66
*
77
* Tested with:
8-
* - Laravel 7.x, 8.x, 9.x, 10.x, 11.x
8+
* - Laravel 7.x, 8.x, 9.x, 10.x, 11.x, 12.x
99
* - Custom/legacy implementations
1010
* - Auto-detection of MAC calculation methods
1111
*

0 commit comments

Comments
 (0)