How to install Laravel without Composer

This article explains how to install Laravel without using Composer, with an example.

Installing Laravel without Composer is possible, but it requires more steps and is not recommended. The process involves downloading the Laravel source code and manually configuring it. We will provide an example of installing Laravel 7.17.0 on a system running PHP 7.3.11.

Step 1: Download the Laravel Source Code

The first step is to download the Laravel source code. You can do this either through the official website or by cloning the repository from GitHub. In this example, we will use the official website:


$ curl -O https://laravel.com/laravel-7.17.0.zip

Once the download is complete, extract the zip file to a location of your choice.

Step 2: Configure the Environment File

The next step is to configure the environment file. This file sets the environment variables for your application. The file is located in the root folder of your project and is named .env. You can edit it using your favorite text editor:


$ vim .env

You need to set the following variables in the file:

  • APP_ENV: Set this to “local”
  • APP_DEBUG: Set this to “true”
  • APP_URL: Set this to the URL of your application
  • DB_HOST: Set this to the hostname of your database
  • DB_USERNAME: Set this to the username of your database
  • DB_PASSWORD: Set this to the password of your database
  • DB_DATABASE: Set this to the name of your database

Once you have set these variables, save and close the file.

Step 3: Install Dependencies

The next step is to install the application dependencies. This is done using the Composer package manager. First, make sure that you have Composer installed on your system. Then, navigate to the root folder of your project and run the command:


$ composer install

This will install the necessary dependencies for your application. Once the installation is complete, you can move on to the next step.

Step 4: Generate the Application Key

The next step is to generate an application key. This key is used to encrypt data in your application. To generate the key, run the command:


$ php artisan key:generate

This will generate a random 32-character key and save it to the .env file. Once this is done, your application is ready to use.

Conclusion

In this tutorial, we have shown how to install Laravel without Composer. This process involves manually downloading the source code, configuring the environment file, installing the dependencies, and generating an application key. While this process is possible, it is not recommended. Instead, it is better to use the official Composer installation method.

Answers (0)