Laravel & Homestead
Today I will talk about Homestead and Laravel.
Let’s start with Laravel. Laravel is a framework that will make your PHP application development more enjoyable. Full-stack offers us many processes that we need while creating a web application in the form of ready-made libraries. I will give an example how to write code in Laravel that I use and Homestead involves here :)
Homestead is a vagrant box provides you an advancing enviroment that you don’t need a web server PHP for your local machine and any set up web software Homestead operating system operates free and includes NGNIX, Redis, PHP, PostgreSQL etc. more several apps. Vagrant can named a very simple container to manage virtual machine.
Homestead needs a virtual server can support Vagrant and I use virtualbox which is free. We download and set up Vagrant after virtualbox.
Note: You need to install Vagrant of the appropriate operating system.
We will create Vagrant after the setup ad we will add laravel/homestead inside box.
vagrant box add laravel/homestead
We have finished virtual server after we run the command.
Note: Windows user might need to change their BIOS settings. You have to enabled VIRTUALIZATION.
As for the Homestead installation, Homestead is open source project in github.com.
git clone https://github.com/laravel/homestead.git ~/Homestead
For use last release;
git checkout release
After installing, In PhpStorm, you need to open Homestead and introduce your project from Homestead.yaml file. Your project directory where is it;
- map: ~/code/project1
After setting project directory;
vagrant up --provision
By running the command, you can see the changes in the Homestead.yaml file and transfer them to the virtual server. The sites you add here,
- map: homestead.test
You can view it via domain and directory browser.
Getting Started With Laravel
What you need to do to start a project with Laravel
composer global require laravel/installer
laravel new example-app
It is as simple as execute above commands, you can define the project you created here to Homestead and perform environment-independent improvements. In the next article, I want to make the Telescope and Compass, which are the tools I like in Laravel, stay tuned.
Talk is cheap, show me the code.
Thanks for reading, stay healthy.