composer laravel create project

composer laravel create project

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Composer create-project misinterpreted paths and manual setup

The error message you are encountering stems from a fundamental misunderstanding of how composer create-project parses its command-line arguments. When you run composer create-project /Applications/MAMP/htdocs/test_laravel, the CLI interprets /Applications/MAMP/htdocs/test_laravel not as a directory name, but as the package name (or repository URL) for a library to install.

Composer is trying to fetch a package literally named /Applications/MAMP/htdocs/test_laravel from the Packagist repository. Since no such package exists in the standard repositories with that specific path-based name, it throws an InvalidArgumentException. The tool expects a valid Composer package name (like laravel/framework) or a directory path relative to the current working directory where the project should be created.

To fix this, you must separate the command into two distinct logical steps: creating the directory and initializing the Composer project within it.

First, navigate to your desired installation location. If you are using MAMP, ensure your terminal is in a writable location or that you have sufficient permissions to write to /Applications/MAMP/htdocs. You can create the folder manually before running the command:

mkdir -p /Applications/MAMP/htdocs/test_laravel
cd /Applications/MAMP/htdocs/test_laravel

Next, run the create-project command pointing only to the package name, leaving the directory specification empty or using the default current path:

composer create-project laravel/laravel .

By appending a dot (.) at the end of the command, you explicitly tell Composer to install the project in the current directory. This approach avoids ambiguity and ensures that the vendor directory and all necessary configuration files are generated correctly inside your test_laravel folder.

Manual Installation vs. Automated Setup

You asked if this step is equal to creating a folder and downloading laravel-master.zip from the Git repository. The answer is no, primarily because of version management and dependency resolution.

Downloading a ZIP file gives you a specific snapshot of the Laravel codebase at that moment in time. While this might work for quick prototyping or legacy projects running on very old PHP versions (like your MAMP 5.4.10 setup), it bypasses Composer's ability to manage dependencies automatically. When you unzip a master branch, you are responsible for manually installing the composer.json dependencies yourself. If you miss a dependency or have a version mismatch, your application will fail to boot.

Using composer create-project is the standard practice for several reasons:

  1. Dependency Resolution: Composer automatically resolves and installs all required packages defined in the Laravel distribution's composer.json.
  2. Version Control: It allows you to specify exact versions or stability levels (e.g., laravel/laravel:^10.0), ensuring you get a stable, tested release rather than bleeding-edge code that might break your environment.
  3. Environment Configuration: The command sets up the necessary composer.lock, artisan entry point, and autoload files correctly.

Compatibility Considerations for MAMP

Your source material mentions using PHP 5.4.10. This is a critical constraint. Laravel 6.x was the last major version to support PHP 5.4. Modern versions (Laravel 7+) require PHP 7.1 or higher, and current LTS versions require PHP 8.1+.

If you are strictly bound to MAMP with PHP 5.4.10, attempting to install a modern Laravel version via Composer will result in dependency resolution failures because no packages support that ancient PHP version. In this specific scenario, manually cloning an older branch (like laravel/legacy) or downloading a specific old release zip might be the only viable path, though it is highly discouraged due to security vulnerabilities inherent in unmaintained codebases.

However, if your goal is simply to learn Laravel, I strongly recommend upgrading your PHP version within MAMP to at least 7.4 or preferably 8.x. This will unlock access to modern features, improved performance, and active community support. Once the PHP version is compatible, revert to the automated composer create-project method for a robust installation.

For further guidance on setting up Laravel environments or troubleshooting specific configuration issues, resources like https://laravelcompany.com can provide detailed tutorials on best practices for managing your project structure.

Our network