diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 49ff729..b063f9c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -19,10 +19,10 @@ jobs: matrix: os: [ubuntu-latest] php: [8.3, 8.2] - laravel: [10.*] + laravel: [11.*] stability: [prefer-stable] include: - - testbench: 8.* + - testbench: 9.* carbon: ^2.63 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index e34bf2b..96f779f 100644 --- a/composer.json +++ b/composer.json @@ -17,15 +17,15 @@ ], "require": { "php": "^8.2", - "illuminate/contracts": "^10.0|^11.0", + "illuminate/contracts": "^11.0", "spatie/laravel-package-tools": "^1.14.0", "spatie/temporary-directory": "^2.2" }, "require-dev": { "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.8", + "nunomaduro/collision": "^8.1", "larastan/larastan": "^2.0.1", - "orchestra/testbench": "^8.8", + "orchestra/testbench": "^9.0", "pestphp/pest": "^2.20", "pestphp/pest-plugin-arch": "^2.5", "pestphp/pest-plugin-laravel": "^2.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index cb247a2..f4a34f0 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,4 +9,3 @@ parameters: tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false diff --git a/src/PrivateKey.php b/src/PrivateKey.php index e94a6e2..7c86d7f 100644 --- a/src/PrivateKey.php +++ b/src/PrivateKey.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; use Spatie\TemporaryDirectory\TemporaryDirectory; +use Symfony\Component\Process\ExecutableFinder; class PrivateKey { @@ -64,7 +65,21 @@ public function decrypt(string $message, bool $base64): string $data = $base64 ? base64_decode(str_replace(['-', '_'], ['+', '/'], $message)) : $message; Storage::build(['driver' => 'local', 'root' => $dir->path()])->put($ulid, $data); - $result = Process::input($this->encode())->run("age -d -i - {$dir->path($ulid)}"); + /** + * @var array|string|null + */ + $command = [ + (new ExecutableFinder())->find('age', 'age', [ + '/usr/local/bin', + '/opt/homebrew/bin', + ]), + '-d', + '-i', + '-', + $dir->path($ulid), + ]; + + $result = Process::input($this->encode())->run($command); if ($result->failed()) { throw new Exception('Failed to decrypt message!'); diff --git a/src/PublicKey.php b/src/PublicKey.php index 5283e70..661718b 100644 --- a/src/PublicKey.php +++ b/src/PublicKey.php @@ -4,6 +4,7 @@ use Exception; use Illuminate\Support\Facades\Process; +use Symfony\Component\Process\ExecutableFinder; class PublicKey { @@ -31,7 +32,19 @@ public function encode(): string */ public function encrypt(string $message, bool $base64): string { - $result = Process::input($message)->run("age -r {$this->encode()}"); + /** + * @var array|string|null + */ + $command = [ + (new ExecutableFinder())->find('age', 'age', [ + '/usr/local/bin', + '/opt/homebrew/bin', + ]), + '-r', + $this->encode(), + ]; + + $result = Process::input($message)->run($command); if ($result->failed()) { throw new Exception('Failed to encrypt message!');