Chapter 1 - Setting up Laravel Environment with Laragon and Composer
Laravel is a popular PHP framework that allows developers to build scalable and robust web applications. In this chapter, we'll show how to set up a Laravel environment using Laragon and Composer.
Laragon is a powerful development environment for PHP that allows you to install and manage PHP, Apache, MySQL, and other tools with ease.
Composer is a dependency management tool for PHP that allows you to manage packages and libraries.
To get started, download and install Laragon from the official website. Laragon comes in two versions: Laragon Full and Laragon Lite. The Full version includes Apache, MySQL, PHP, Node.js, and Git, while the Lite version includes only PHP and MySQL. I always recommend you to download the full version of Laragon.
Once you've downloaded the installer, run it and follow the instructions to install Laragon on your computer.
Next, you'll need to install Composer. Composer is a dependency manager for PHP that allows you to manage packages and libraries.
To install Composer,
- You can download the installer from their official website and follow the instruction to install composer on your system.
2. Or install through the command prompt or terminal and run the following command:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -r "unlink('composer-setup.php');"
This will download and install Composer on your computer.
Now that you have Laragon and Composer installed, you're ready to set up Laravel. You can use three ways to install a Laravel application
- using the composer command. As we're using Laragon so, all the projects we'll keep in our Laragon directory. So open up the terminal inside Laragon/www or open the terminal and fire the below commands
cd c: cd laragon/www //path of the laragon folder. use your laragon installation path composer create-project laravel/laravel example-app //for creating laravel application
and this will create a brand new application of Laravel project.
2. Using Laravel Installer:
cd c: cd laragon/www //path of the laragon folder. use your laragon installation path composer global require laravel/installer laravel new example-project //for creating laravel application
and this will create a brand-new application of Laravel project.
And as we using Laragon we can install through Laragon as well. To do this, follow these steps:
- Open Laragon and click on the "Quick app" folder in the sidebar.
- Select "Laravel" from the list of available options.
- Enter a project name and click on the "Create" button.
- Laragon will now download and install Laravel, along with its dependencies and database.
Once the installation is complete, you can open the project in your web browser by clicking on the "www" button and selecting the project from the list.
Congratulations! You've now set up a Laravel environment using Laragon and Composer. And remember always run the project with .test domain which is created by default from Laragon. Like if the project name is movie, we can enter it through the browser using movie.test (make sure to restart the Laragon after creating each project . Sometimes it cannot detect the project)
In this chapter, we've shown you how to set up a Laravel environment using Laragon and Composer. With this environment, we can now start building our own Laravel applications and take advantage of Laravel's powerful features and functionality.
Let's meet at the next chapter. In the next chapter, we'll discuss about the Laravel intro part.