Skip to content

feat: add support for Laravel 12 #510

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

Merged
merged 5 commits into from
Jun 13, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.2', '8.3']
php: ['8.2', '8.3', '8.4']
dependency-version: [lowest, highest]

name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}
Expand Down Expand Up @@ -38,4 +38,4 @@ jobs:
composer-options: "--prefer-dist"

- name: Run Tests
run: vendor/bin/pest
run: vendor/bin/pest --display-deprecation ${{ matrix.dependency-version == 'highest' && '--fail-on-deprecation' || '' }}
68 changes: 34 additions & 34 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,51 @@
"require": {
"php": "^8.2",
"ext-json": "*",
"dragonmantank/cron-expression": "^3.4.0",
"dragonmantank/cron-expression": "^3.4",
"guzzlehttp/guzzle": "^7.9.2",
"illuminate/cache": "^11.30.0",
"illuminate/collections": "^11.30.0",
"illuminate/config": "^11.30.0",
"illuminate/console": "^11.30.0",
"illuminate/container": "^11.30.0",
"illuminate/contracts": "^11.30.0",
"illuminate/events": "^11.30.0",
"illuminate/filesystem": "^11.30.0",
"illuminate/process": "^11.30.0",
"illuminate/support": "^11.30.0",
"illuminate/testing": "^11.30.0",
"laravel-zero/foundation": "^11.5.0",
"illuminate/cache": "^12.17",
"illuminate/collections": "^12.17",
"illuminate/config": "^12.17",
"illuminate/console": "^12.17",
"illuminate/container": "^12.17",
"illuminate/contracts": "^12.17",
"illuminate/events": "^12.17",
"illuminate/filesystem": "^12.17",
"illuminate/process": "^12.17",
"illuminate/support": "^12.17",
"illuminate/testing": "^12.17",
"laravel-zero/foundation": "^12.17.1",
"laravel/prompts": "^0.3.1",
"league/flysystem": "^3.29.1",
"nunomaduro/collision": "^8.5.0",
"nunomaduro/collision": "^8.8",
"nunomaduro/laravel-console-summary": "^1.12.1",
"nunomaduro/laravel-console-task": "^1.9",
"nunomaduro/laravel-desktop-notifier": "^2.8.1",
"nunomaduro/termwind": "^2.2.0",
"psr/log": "^3.0.2",
"ramsey/uuid": "^4.7.6",
"symfony/console": "^7.1.6",
"symfony/error-handler": "^7.1.6",
"symfony/event-dispatcher": "^7.1.6",
"symfony/finder": "^7.1.6",
"symfony/process": "^7.1.6",
"symfony/var-dumper": "^7.1.6",
"symfony/console": "^7.2",
"symfony/error-handler": "^7.2",
"symfony/event-dispatcher": "^7.2",
"symfony/finder": "^7.2",
"symfony/process": "^7.2",
"symfony/var-dumper": "^7.2",
"vlucas/phpdotenv": "^5.6.1"
},
"require-dev": {
"illuminate/bus": "^11.30.0",
"illuminate/database": "^11.30.0",
"illuminate/http": "^11.30.0",
"illuminate/log": "^11.30.0",
"illuminate/queue": "^11.30.0",
"illuminate/redis": "^11.30.0",
"illuminate/view": "^11.30.0",
"laravel-zero/phar-updater": "^1.4",
"laravel/pint": "^1.18.1",
"nunomaduro/laravel-console-dusk": "^1.13.1",
"nunomaduro/laravel-console-menu": "^3.5",
"pestphp/pest": "^3.5.1",
"phpstan/phpstan": "^1.12.7"
"illuminate/bus": "^12.17",
"illuminate/database": "^12.17",
"illuminate/http": "^12.17",
"illuminate/log": "^12.17",
"illuminate/queue": "^12.17",
"illuminate/redis": "^12.17",
"illuminate/view": "^12.17",
"laravel-zero/phar-updater": "^1.4.1",
"laravel/pint": "^1.21",
"nunomaduro/laravel-console-dusk": "^1.14",
"nunomaduro/laravel-console-menu": "^3.6",
"pestphp/pest": "^3.8",
"phpstan/phpstan": "^2.1"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -102,7 +102,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "11.x-dev"
"dev-master": "12.x-dev"
}
},
"suggest": {
Expand Down
2 changes: 2 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
stopOnError="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Tests">
Expand Down
1 change: 1 addition & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function registerConfiguredProviders(): void
$providers->splice(
1,
0,
// @phpstan-ignore argument.type
[
$this->make(PackageManifest::class)
->providers(),
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getSubscribedSignals(): array
}

/** {@inheritdoc} */
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false
public function handleSignal(int $signal, int|false $previousExitCode = 0): int
{
if (defined('SIGINT') && $signal === \SIGINT) {
if (self::$config !== null) {
Expand Down
3 changes: 3 additions & 0 deletions src/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ abstract class Command extends BaseCommand
*/
protected $app;

/** {@inheritdoc} */
protected $description = '';

/**
* Define the command's schedule.
*/
Expand Down
1 change: 1 addition & 0 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function handle()
$option = $this->choice($title, $choices);
}

// @phpstan-ignore notIdentical.alwaysTrue
if ($option !== null && ! empty($this->componentInstallers[$option])) {
/** @var AbstractInstaller $command */
$command = $this->app[$this->componentInstallers[$option]];
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Database/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class Installer extends AbstractInstaller
*/
public function install(): void
{
$this->require('illuminate/database "^11.5"');
$this->require('illuminate/database "^12.17"');
$this->require('fakerphp/faker "^1.23"', true);

$this->task(
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Http/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ final class Installer extends AbstractInstaller
*/
public function install(): void
{
$this->require('illuminate/http "^11.5"');
$this->require('illuminate/http "^12.17"');
}
}
2 changes: 1 addition & 1 deletion src/Components/Log/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class Installer extends AbstractInstaller
*/
public function install(): void
{
$this->require('illuminate/log "^11.5"');
$this->require('illuminate/log "^12.17"');

$this->task(
'Creating default logging configuration',
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Queue/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function install(): void
{
$this->call('app:install', ['component' => 'database']);

$this->require('illuminate/bus "^11.5"');
$this->require('illuminate/queue "^11.5"');
$this->require('illuminate/bus "^12.17"');
$this->require('illuminate/queue "^12.17"');

$this->task(
'Creating default queue configuration',
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Redis/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ final class Installer extends AbstractInstaller
/** {@inheritdoc} */
public function install(): void
{
$this->require('illuminate/redis "^11.5"');
$this->require('illuminate/redis "^12.17"');
}
}
2 changes: 1 addition & 1 deletion src/Components/View/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class Installer extends AbstractInstaller
*/
public function install(): void
{
$this->require('illuminate/view "^11.5"');
$this->require('illuminate/view "^12.17"');

$this->task(
'Creating resources/views folder',
Expand Down
6 changes: 6 additions & 0 deletions src/Providers/Filesystem/FilesystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@ protected function getDefaultConfig(): array
],
];
}

/** Laravel Zero doesn't support serving files. */
protected function shouldServeFiles(array $config)
{
return false;
}
}
16 changes: 2 additions & 14 deletions tests/Application/bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
<?php

$app = new LaravelZero\Framework\Application(
realpath(dirname(__DIR__))
);
use LaravelZero\Framework\Application;

$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
LaravelZero\Framework\Kernel::class
);

$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
Illuminate\Foundation\Exceptions\Handler::class
);

return $app;
return Application::configure(basePath: dirname(__DIR__))->create();
2 changes: 1 addition & 1 deletion tests/Components/LogInstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

$composerMock->expects($this->once())
->method('require')
->with('illuminate/log "^11.5"');
->with('illuminate/log "^12.17"');

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down
2 changes: 1 addition & 1 deletion tests/Components/RedisInstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$composerMock->expects($this->once())
->method('require')
->with('illuminate/redis "^11.5"', false);
->with('illuminate/redis "^12.17"', false);

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down
17 changes: 4 additions & 13 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,34 @@

namespace Tests;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
use LaravelZero\Framework\Application;
use LaravelZero\Framework\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
/**
* The application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
* @var ApplicationContract
*/
protected $app;

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
protected function setUp(): void
{
if (! defined('ARTISAN_BINARY')) {
define('ARTISAN_BINARY', 'application');
}

parent::setUp();

$this->app = $this->createApplication();
}

/**
* Creates a new instance of the application.
*/
public function createApplication(): ApplicationContract
{
$app = require __DIR__.'/Application/bootstrap/app.php';

Application::setInstance($app);

$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$app->make(Kernel::class)->bootstrap();

return $app;
}
Expand Down