Create New Post

Laravel - Installation

Installing Laravel involves a few steps, and it assumes that you have PHP and Composer already installed on your system.
You will have to follow the steps given below for installing Laravel onto your system.
 

  1. PHP: Ensure that PHP is installed on your system. Laravel requires PHP 7.3.0 or higher.

  2. Composer: Composer is a dependency manager for PHP. Install Composer by following the instructions on the official Composer website.
     

  3. Install Laravel via Composer: Open a terminal or command prompt and run the following command to create a new Laravel project:

    composer create-project --prefer-dist laravel/laravel your-project-name

    Replace your-project-name with the desired name for your Laravel project. This command downloads the Laravel framework and its dependencies.

  4. Navigate to Your Project Directory: Change into the newly created project directory:

    cd your-project-name 

  5. Generate Application Key: Laravel requires an application key for security purposes. Run the following command to generate the key:

    php artisan key:generate 

  6. Configure the Database: Open the .env file in the root of your project and configure the database settings, including the database name, username, and password.

    DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_username DB_PASSWORD=your_database_password 
     

    Save the changes.

  7. Run Migrations: Run the following command to migrate the database tables:

    php artisan migrate 

    This command creates the necessary tables in your configured database.

  8. Serve Your Application: You can use the built-in server to run your Laravel application. Execute the following command:

    php artisan serve 

    This will start a development server, and you can access your Laravel application by visiting http://127.0.0.1:8000 in your web browser.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

12064