Preparing the development environment on Windows to develop apps in Laravel with Laragon
In this entry we are going to talk about the UNofficial environment that is perfect for developing our applications if you are using Windows, which cannot be other than the one known as Laragon; this peculiar tool brings us everything necessary to develop our applications in this popular framework for PHP; first, let's see what Laragon is.
Laragon, el entorno más facil para desarrollar en Laravel
Laragon is a tool for developers that allows you to create different web development environments; not only for Laravel, but you can use it for other technologies such as PHP with other frameworks, Node, Python, Java, Go, Ruby and much more. Laragon runs on Windows, and is created to work with web applications in the Laravel framework; that is, as soon as we download the installer, we will be able to create projects in Laravel from now on without the need to install additional dependencies.
And as a reward, Laragon provides an isolated development environment, which means that it does not make changes at the Operating System level, otherwise it lives in a separate folder from the Operating System, therefore, you can have other solutions such as XAMPP and enable one or the other.
In addition, Laragon is fast and powerful and allows you to deploy projects with a single click; In the case of Laravel, when restarting the server, the clean URL is automatically generated by an Apache Virtual Host of the PHP projects, including Laravel, therefore, we already have the access URL to the project. Furthermore, Laragon is an interesting option for those developers looking for a solution to work with PHP on Windows; since, it even installs a friendlier console than the Windows CMD to develop.
Having this clear, we are going to continue talking about the advantages of Laragon in Windows; you can use this environment in any version of Laravel, including the most recent ones like Laravel 10.
Problems when starting with Laravel
One of the drawbacks that Laravel has is its learning curve or the first contacts we have with the framework, what happens from installation to taking the first steps with it; the installation of the framework ecosystem goes through several steps of complexity that goes from the range of technologies that it can cover that goes from our LAMP to reaching the entire Node ecosystem until reaching the installation of the environment to develop our applications in any OS.
In the case of Windows, it is not particularly easy to install this entire ecosystem (although it is not as simple as expected in MacOS either) whose official steps involve installing a virtualization of the system, that is, installing a virtual machine based on Ubuntu.
Luckily, there is a tool known as Laragon, which brings us everything we need to develop our applications in Windows.
As I told you before, to develop our applications in Laravel, we require multiple tools, a set of tools that we have to have installed on our computer and Laragon basically offers us a package of all these tools, so, in a few words, with With just one installer, we can have the entire necessary ecosystem.
About Laragon to develop apps in Laravel
On the official website you can see all the features and technologies that this tool offers us:
- PHP
- Apache
- Nginx
- MySQL
- Node
- A decent terminal
- Among other things
Install Laragon on Windows
Installing Laragon has been the usual; download and install:
Here I recommend the full version (Laragon Full) that weighs about 130Mb
Remember to give it permissions on the OS, since it must touch system files when generating projects, such as the Windows host that has to match the generated virtualhost that is necessary when generating the clean URL to be able to develop our applications in Laravel.
Verify Installations: Composer
Now with our Laragon fully loaded, let's do some testing to install the Laravel installer even if it sounds redundant...
Install laravel/installer
On the official Laravel page, you can find all the information you need to start developing your applications in Laravel; among that pertinent information we have the necessary ecosystem (our Laragon works perfectly for us) and how we can install Laravel.
To install Laravel you have to open your Laragon terminal and run the following composer command:
composer global require laravel/installer
And position yourself on the www folder of your Laragon (in case you are no longer there):
Which would be the one we use to install the Laravel installer according to the official documentation:
And with this, we are ready to create our first project; for that we execute:
laravel new laratest
And if we restart our Laragon (turn off the services and start again) we are ready to see our brand new project in the browser:
http://laratest.test/
Where the url is basically the name of your project with the extension of .test
- Andrés Cruz
Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter