Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracasts9924's avatar

can lumen 7 run using php 8.1?

I just tested my lumen 7 app (just upgrade from lumen 6) on php 8.1 and getting framework errors. It runs fine on php 7.4. Does lumen 7 not work on php 8.1 here is a screenshot of my errors. It looks like all of the errors are from the framework.


Deprecated: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\container\Container.php on line 1281

Deprecated: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\container\Container.php on line 1293

Deprecated: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\container\Container.php on line 1306

Deprecated: Return type of Illuminate\Config\Repository::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\config\Repository.php on line 141

Deprecated: Return type of Illuminate\Config\Repository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\config\Repository.php on line 152

Deprecated: Return type of Illuminate\Config\Repository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\config\Repository.php on line 164

Deprecated: Return type of Illuminate\Config\Repository::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\config\Repository.php on line 175

Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Database\Eloquent\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\database\Eloquent\Model.php:1658 Stack trace: #0 C:\laragon\www\test-lumen-7\vendor\illuminate\database\Eloquent\Model.php(23): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(8192, 'Return type of ...', 'C:\laragon\www\...', 1658) #1 C:\laragon\www\test-lumen-7\vendor\composer\ClassLoader.php(571): include('C:\laragon\www\...') #2 C:\laragon\www\test-lumen-7\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('C:\laragon\www\...') #3 C:\laragon\www\test-lumen-7\vendor\illuminate\database\DatabaseServiceProvider.php(42): Composer\Autoload\ClassLoader->loadClass('Illuminate\Data...') #4 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Application.php(233): Illuminate\Database\DatabaseServiceProvider->register() #5 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Application.php(665): Laravel\Lumen\Application->register(Object(Illuminate\Database\DatabaseServiceProvider)) #6 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Application.php(410): Laravel\Lumen\Application->loadComponent('database', Array, 'db') #7 C:\laragon\www\test-lumen-7\vendor\illuminate\container\Container.php(805): Laravel\Lumen\Application->Laravel\Lumen\{closure}(Object(Laravel\Lumen\Application), Array) #8 C:\laragon\www\test-lumen-7\vendor\illuminate\container\Container.php(691): Illuminate\Container\Container->build(Object(Closure)) #9 C:\laragon\www\test-lumen-7\vendor\illuminate\container\Container.php(637): Illuminate\Container\Container->resolve('db', Array) #10 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Application.php(300): Illuminate\Container\Container->make('db', Array) #11 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Application.php(778): Laravel\Lumen\Application->make('db') #12 C:\laragon\www\test-lumen-7\bootstrap\app.php(50): Laravel\Lumen\Application->withEloquent() #13 C:\laragon\www\test-lumen-7\public\index.php(14): require('C:\laragon\www\...') #14 {main} in C:\laragon\www\test-lumen-7\vendor\illuminate\database\Eloquent\Model.php on line 23

Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laragon\www\test-lumen-7\vendor\illuminate\support\Collection.php:1349 Stack trace: #0 C:\laragon\www\test-lumen-7\vendor\illuminate\support\Collection.php(11): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(8192, 'Return type of ...', 'C:\laragon\www\...', 1349) #1 C:\laragon\www\test-lumen-7\vendor\composer\ClassLoader.php(571): include('C:\laragon\www\...') #2 C:\laragon\www\test-lumen-7\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('C:\laragon\www\...') #3 C:\laragon\www\test-lumen-7\vendor\illuminate\support\helpers.php(110): Composer\Autoload\ClassLoader->loadClass('Illuminate\Supp...') #4 C:\laragon\www\test-lumen-7\vendor\illuminate\log\LogManager.php(240): collect(Array) #5 C:\laragon\www\test-lumen-7\vendor\illuminate\log\LogManager.php(202): Illuminate\Log\LogManager->createStackDriver(Array) #6 C:\laragon\www\test-lumen-7\vendor\illuminate\log\LogManager.php(118): Illuminate\Log\LogManager->resolve('stack') #7 C:\laragon\www\test-lumen-7\vendor\illuminate\log\LogManager.php(98): Illuminate\Log\LogManager->get('stack') #8 C:\laragon\www\test-lumen-7\vendor\illuminate\log\LogManager.php(543): Illuminate\Log\LogManager->driver() #9 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Exceptions\Handler.php(56): Illuminate\Log\LogManager->error('During inherita...', Array) #10 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Concerns\RegistersExceptionHandlers.php(119): Laravel\Lumen\Exceptions\Handler->report(Object(Symfony\Component\ErrorHandler\Error\FatalError)) #11 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Concerns\RegistersExceptionHandlers.php(67): Laravel\Lumen\Application->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError)) #12 C:\laragon\www\test-lumen-7\vendor\laravel\lumen-framework\src\Concerns\RegistersExceptionHandlers.php(55): Laravel\Lumen\Application->handleShutdown() #13 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() #14 {main} in C:\laragon\www\test-lumen-7\vendor\illuminate\support\Collection.php on line 11
0 likes
4 replies
laracasts9924's avatar

@neilstee thanks, that is my thought also. Just wanted to see if others thought the same. I do have plans to update to lumen 8 but I wanted to test my lumen 7 first. So I will have to test my lumen 7 on php 7.4 first. then update to lumen 8 and then I should be able to then go to php 8.1.

1 like
stefanijaK's avatar

@laracasts9924 did you actually manage to test if Lumen is working on 8.1? As far as I can see from the official repo, the supported version is 8.0.

Thank you in advance for your feedback

laracasts9924's avatar

@stefanijak sorry I cannot be of any help with an answer. We put that on hold for right now as we have other projects of higher importance. The latest version I can get Lumen 7 working on is php 7.4. When I change my php version to 8.1, I do get the above posted errors and have not had the time to do any more digging or research.

Please or to participate in this conversation.