Problem creating a new project with Laravel

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company

Solving the Dreaded Dependency Error: Creating a New Laravel Project

As developers, we often find ourselves hitting unexpected roadblocks when setting up new projects, especially when dealing with complex dependencies managed by tools like Composer. If you are just starting your journey with Laravel and encounter an error during the project creation process, don't panic. This is a very common hurdle, and understanding why it happens is the first step to mastering development environments.

Today, we are diving deep into a specific dependency conflict that often pops up when using composer create-project laravel/laravel. We will analyze the error you encountered and provide a practical, developer-focused solution.

Understanding the Dependency Conflict

When you run the command:

composer create-project laravel/laravel new-project

Composer attempts to download and install Laravel and all its required packages. The specific error message you received points directly to a conflict involving league/flysystem, which is a package used internally by Laravel for file storage (like cloud storage).

Here is the breakdown of the problem:

Problem 1
- laravel/framework[v8.12.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
- league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^8.12 -> satisfiable by laravel/framework[v8.12.0, ..., 8.x-dev].

The core issue is not with Laravel itself, but with the underlying PHP environment. The league/flysystem library depends on the PHP extension fileinfo. If this extension is not installed or enabled for your specific PHP installation, Composer cannot satisfy the dependency requirements, and the installation fails. This is a classic case of missing system prerequisites rather than a faulty Laravel command.

The Solution: Enabling the Missing PHP Extension

The solution lies outside of the Composer commands themselves; it requires configuring your operating system's PHP environment to include the necessary extensions. Since you are working with PHP 8, the steps vary slightly depending on whether you are using a package manager (like APT or YUM) or compiling from source.

Step 1: Check Current PHP Configuration

First, verify which extensions are currently enabled in your system:

php -m

If fileinfo is not listed, you have confirmed the issue.

Step 2: Install the fileinfo Extension

The method for installing this extension depends entirely on your Linux distribution (e.g., Ubuntu, Debian, CentOS).

For Debian/Ubuntu Systems:
You need to install the package that provides the fileinfo module for your specific PHP version (e.g., PHP 8.1 or 8.2).

sudo apt update
sudo apt install php8.x-fileinfo  # Replace '8.x' with your installed PHP version, e.g., php8.2-fileinfo

For CentOS/RHEL Systems (using EPEL/Remi repositories):
If you are on a Red Hat-based system, the process usually involves enabling the necessary module:

sudo yum install php-fileinfo  # Or use dnf if using newer Fedora systems

Step 3: Restart the Web Server (Optional but Recommended)

While this error primarily affects Composer execution, it's good practice to restart your web server or PHP service after enabling new extensions to ensure the change is fully registered:

sudo systemctl restart php8.x-fpm  # Or apache2/nginx depending on your setup

Best Practices for Environment Setup

This experience highlights a crucial principle in modern software development: the environment must be configured before the application can be built. When setting up any framework, especially one as robust as Laravel, ensure your base PHP installation is fully populated with necessary extensions before attempting to run project creation commands.

When you are setting up a new system, always prioritize checking prerequisites. For deeper insights into modern PHP development and framework setup, I highly recommend exploring the official documentation provided by the team at laravelcompany.com. They provide excellent guidance on maintaining a clean and functional environment for all Laravel projects.

Conclusion

By understanding that dependency errors often stem from missing system prerequisites rather than application code flaws, we can move from debugging commands to fixing system configurations. The fix for the ext-fileinfo error is straightforward: install the required PHP extension via your operating system's package manager. Once this prerequisite is met, Composer will be able to resolve all dependencies successfully, allowing you to create your new Laravel project without further interruption. Happy coding!