From 2c3f0e1e2ecea0dc55ba96ab400d45cd952beeff Mon Sep 17 00:00:00 2001 From: HM Tanbir Date: Fri, 18 Apr 2025 16:04:45 +0600 Subject: [PATCH] upgrade laravel version to 12.x --- .github/workflows/PHP8.1.yml | 2 +- .github/workflows/PHP8.2.yml | 2 +- .github/workflows/PHP8.3.yml | 43 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- composer.json | 24 ++++++++++---------- config/sanctum.php | 1 + docker-compose.yml | 2 +- 7 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/PHP8.3.yml diff --git a/.github/workflows/PHP8.1.yml b/.github/workflows/PHP8.1.yml index 0bb29c5..5dbf366 100644 --- a/.github/workflows/PHP8.1.yml +++ b/.github/workflows/PHP8.1.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/PHP8.2.yml b/.github/workflows/PHP8.2.yml index 332c9e5..69aac57 100644 --- a/.github/workflows/PHP8.2.yml +++ b/.github/workflows/PHP8.2.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/PHP8.3.yml b/.github/workflows/PHP8.3.yml new file mode 100644 index 0000000..d7db181 --- /dev/null +++ b/.github/workflows/PHP8.3.yml @@ -0,0 +1,43 @@ +name: "PHP 8.3 Tests" + +on: [push, pull_request] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [8.3] + + name: PHP${{ matrix.php }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv + coverage: none + + - name: Install dependencies + run: composer install + + - name: Create Environment file and generate app key + run: | + cp .env.example .env + + php artisan key:generate + + - name: Create database and run migration + run: | + touch database/hydra.sqlite + php artisan migrate + php artisan db:seed + + - name: Execute tests + run: vendor/bin/phpunit diff --git a/README.md b/README.md index 4e71f9d..2a90e72 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Hydra is a zero-config API boilerplate with Laravel Sanctum and comes with excellent user and role management API out of the box. Start your next big API project with Hydra, focus on building business logic, and save countless hours of writing boring user and role management API again and again. -Hydra works with Laravel 10.x and Sanctum 3.x. If you want to work with Laravel 9.x then checkout the 9.x branch. +Hydra works with Laravel 12.x and Sanctum 12.x. If you want to work with Laravel 12.x then checkout the 12.x branch. - [Hydra - Zero Config API Boilerplate with Laravel Sanctum](#hydra---zero-config-api-boilerplate-with-laravel-sanctum) - [Getting Started](#getting-started) diff --git a/composer.json b/composer.json index 189965c..5419084 100644 --- a/composer.json +++ b/composer.json @@ -8,20 +8,20 @@ ], "license": "MIT", "require": { - "php": "^8.1", - "guzzlehttp/guzzle": "^7.4.4", - "laravel/framework": "^10.0", - "laravel/sanctum": "^3.2", - "laravel/tinker": "^2.7" + "php": "^8.2", + "guzzlehttp/guzzle": "^7.0.0", + "laravel/framework": "^12.0", + "laravel/sanctum": "^4.0", + "laravel/tinker": "^2.10.1" }, "require-dev": { - "fakerphp/faker": "^1.9.1", - "laravel/pint": "^1.1.0", - "laravel/sail": "^1.15", - "mockery/mockery": "^1.4.4", - "nunomaduro/collision": "^7.0", - "phpunit/phpunit": "^10.0", - "spatie/laravel-ignition": "^2.0" + "fakerphp/faker": "^1.24.1", + "laravel/pint": "^1.21", + "laravel/sail": "^1.41", + "mockery/mockery": "^1.6", + "nunomaduro/collision": "^8.6", + "phpunit/phpunit": "^11.5.3", + "spatie/laravel-ignition": "^2.9.1" }, "autoload": { "psr-4": { diff --git a/config/sanctum.php b/config/sanctum.php index 529cfdc..0195a4f 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -62,6 +62,7 @@ return [ 'middleware' => [ 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, + 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class, ], ]; diff --git a/docker-compose.yml b/docker-compose.yml index 73d8c98..5dc9c2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: dockerfile: Dockerfile args: WWWGROUP: '${WWWGROUP}' - image: sail-8.1/app + image: sail-8.2/app extra_hosts: - 'host.docker.internal:host-gateway' ports: