Rrequirements and steps to install Laravel on a new machine

Sure! Here’s the updated summary that includes the Laravel installer (laravel new example-app) step:

Requirements:

  1. PHP (>= 8.0): Laravel is built on PHP, so it’s required.
  2. Composer: Dependency manager for installing Laravel and its packages.
  3. Laravel Installer (optional): A tool for quickly creating new Laravel projects.
  4. Database: MySQL or MariaDB for managing the database (optional but recommended).
  5. Node.js and npm: For managing front-end assets like JavaScript and CSS.

Steps to Install Laravel:

  1. Install PHP: Install PHP and necessary extensions:
    sudo apt install php php-cli php-fpm php-mbstring php-xml php-bcmath php-json php-zip php-curl php-mysql
  2. Install Composer: Composer is required to manage Laravel’s dependencies.
    curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer
  3. Install Laravel Installer (Optional but recommended for laravel new command): Install the Laravel installer globally using Composer:
    composer global require laravel/installer
    Note: Ensure that Composer’s global bin directory is in your system’s PATH.
  4. Install MySQL/MariaDB (if using a database): Install MySQL or MariaDB to manage databases.
    sudo apt install mysql-server sudo mysql_secure_installation
  5. Install Node.js and npm (for front-end dependencies): Install Node.js and npm (used for compiling assets like JavaScript and CSS).
    sudo apt install nodejs npm
  6. Create a New Laravel Project Using Laravel Installer: Use the Laravel installer to create a new project:
    laravel new example-app
    Alternatively, you can use Composer to create a new project:
    composer create-project --prefer-dist laravel/laravel example-app
  7. Set Up .env File for Database: Edit the .env file in the root of your Laravel project to configure your database settings (e.g., DB_USERNAME, DB_PASSWORD, DB_DATABASE).
  8. Run Database Migrations (if using a database): If you are using a database, run migrations to set up the required tables:
    php artisan migrate
  9. Install Front-End Dependencies: Inside your Laravel project folder, install the necessary front-end dependencies:
    npm install
  10. Serve the Application: Start the built-in Laravel development server:
    php artisan serve The application should now be accessible at http://127.0.0.1:8000.

That’s the full summary of the steps to install and create a new Laravel project using the laravel new command, or via Composer.

Let me know if you need further clarification! 😊