Read Time:1 Minute, 13 Second
Installing Laravel: A Step-by-Step Guide (Environment Setup)
To install Laravel on your machine, follow these steps:
- Install PHP and required extensions: Laravel requires PHP 7.3 or higher and some extensions such as BCMath, Ctype, JSON, Mbstring, OpenSSL, PDO, Tokenizer, and XML. You can install them using your operating system’s package manager or manually.
- Install Composer: Composer is a dependency manager for PHP. You can download and install it from the official website https://getcomposer.org/. Follow the instructions for your operating system.
- Install Laravel Installer: Laravel has its own command-line tool called “Laravel Installer” that makes it easy to create new Laravel projects. You can install it globally using Composer by running the following command:
composer global require laravel/installer
- Create a new Laravel project: Once you have installed Laravel Installer, you can create a new Laravel project by running the following command:
laravel new project-name
- Replace “project-name” with the name of your project.
- Start the development server: Laravel comes with a built-in development server that you can use to test your application. To start the server, run the following command inside your project directory:
php artisan serve
- This will start the server at http://localhost:8000. You can now open this URL in your browser to see the default Laravel welcome page.
Congratulations! You have successfully installed Laravel on your machine. You can now start building your application using Laravel’s powerful features and tools.