Sure! Here’s the updated summary that includes the Laravel installer (laravel new example-app) step:
Requirements:
- PHP (>= 8.0): Laravel is built on PHP, so it’s required.
- Composer: Dependency manager for installing Laravel and its packages.
- Laravel Installer (optional): A tool for quickly creating new Laravel projects.
- Database: MySQL or MariaDB for managing the database (optional but recommended).
- Node.js and npm: For managing front-end assets like JavaScript and CSS.
Steps to Install Laravel:
- 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 - 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 - Install Laravel Installer (Optional but recommended for
laravel newcommand): Install the Laravel installer globally using Composer:composer global require laravel/installer
Note: Ensure that Composer’s globalbindirectory is in your system’s PATH. - Install MySQL/MariaDB (if using a database): Install MySQL or MariaDB to manage databases.
sudo apt install mysql-server sudo mysql_secure_installation - 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 - 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 - Set Up
.envFile for Database: Edit the.envfile in the root of your Laravel project to configure your database settings (e.g.,DB_USERNAME,DB_PASSWORD,DB_DATABASE). - Run Database Migrations (if using a database): If you are using a database, run migrations to set up the required tables:
php artisan migrate - Install Front-End Dependencies: Inside your Laravel project folder, install the necessary front-end dependencies:
npm install - Serve the Application: Start the built-in Laravel development server:
php artisan serveThe application should now be accessible athttp://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! 😊
