How to fix laravel/ui error to upgrade Laravel after upgrading PHP to 8.0
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
How to Fix Laravel/UI Errors After Upgrading PHP to 8.0
Upgrading your PHP version is a crucial step for modernizing your application stack, but it often introduces dependency conflicts, especially when dealing with older packages or legacy codebases. If you’ve recently upgraded PHP to 8.0 using tools like brew on macOS and encountered frustrating errors during composer update, you are not alone.
This guide will walk you through the exact cause of the conflict in your specific scenario and provide a robust, step-by-step solution to resolve these dependency issues, ensuring your Laravel application remains stable and compatible with PHP 8.0.
Understanding the Composer Conflict
The error output you provided clearly highlights a classic dependency resolution problem:
laravel/ui[v2.1.0, ..., v2.4.1] require php ^7.2.5 -> your php version (8.0.0) does not satisfy that requirement.
...
laravel/framework[v8.0.0, ..., v8.11.2] require php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.
The Root Cause:
When you upgraded PHP to 8.0, the existing dependencies listed in your composer.json (specifically laravel/ui and older versions of illuminate/support) were written for older PHP versions (like 7.2 or 7.3). They explicitly state a requirement that the PHP version must be less than 8.0 (^7.2.5). Since your environment is now running PHP 8.0, Composer cannot find a set of packages that simultaneously satisfies both the requirements of your dependencies and the constraints of the new PHP version.
This situation often arises when working with projects that haven't been fully migrated to support modern Laravel standards, which is something we see frequently in older tutorials or legacy codebases.
Step-by-Step Fix for Laravel UI Conflicts
Since you are dealing with a conflict between old package requirements and the new PHP version, the solution involves forcing an update of those packages or migrating them to versions compatible with PHP 8.0+.
Step 1: Check Your composer.json
First, review your project's composer.json file. Notice how it explicitly requires older constraints for certain packages:
"require": {
"php": "^8.0",
"laravel/framework": "^8.0",
"laravel/ui": "^2.1", // This is the problematic dependency
// ... other requirements
}
Step 2: Attempt a Clean Update (The Standard Approach)
While this often fails with deep conflicts, it's the mandatory first step:
composer update
If this still fails, we need to manually adjust the package versions to align with modern Laravel expectations.
Step 3: Migrating Legacy Packages
For a project based on Laravel 8 or newer (which aligns with PHP 8.0), you should aim to use the latest compatible versions of all components. If you are using an older theme like Laravel UI v2, you might need to consider migrating it or finding a modern alternative, as maintaining very old packages can introduce security vulnerabilities and compatibility headaches.
A safer approach, especially when dealing with core framework issues, is to ensure your entire Laravel dependency tree is aligned. If possible, look into upgrading the specific package causing the issue. For general guidance on structuring modern Laravel projects and dependencies, always refer to the official documentation at laravelcompany.com.
If direct updates fail, you may need to manually adjust the version constraints in composer.json to allow Composer to resolve the dependency tree for PHP 8.0. For instance, ensure all required packages specify compatible versions that support PHP 8.x.
Step 4: Handling Core Framework Dependencies (The Deeper Fix)
If the conflict persists, it often means you are fighting against internal framework changes. When upgrading major components like Laravel, developers usually transition to the latest stable release. Ensure your laravel/framework version is compatible with the rest of the ecosystem.
After making any manual adjustments to composer.json, run the update command again:
composer update --no-dev
This command focuses only on production dependencies, which can sometimes bypass conflicts caused by development packages (require-dev).
Conclusion
Upgrading PHP and managing dependencies is an exercise in balancing new features with existing code structure. The error you encountered stems from the incompatibility between older package requirements and the newer PHP runtime constraints. By understanding the dependency graph, manually reviewing your composer.json, and adopting a strategy of upgrading legacy components or migrating them to modern equivalents, you can successfully navigate this transition. Remember, staying current with framework best practices is key to long-term stability, and that's why we emphasize the official resources available at laravelcompany.com for all your development needs.