Hi guys! First of all, I just want to tell you that this is my first time writing a blog on Medium. Another thing is I am not an English speaker but I am Thai. Thus, if there are anything wrong grammatically and technically, please help me correct them! Alright, let’s begin!!!
If you are not struggling with Laravel or Laradock installation in offical website (https://laravel.com/) (http://laradock.io), you can skip this article.
For me, I was confusing when I first tried to install them. This is the reason why I am writing this article.
What is Laravel?
Simply, Laravel framework is a PHP framework for web application development that using MVC (Model-View-Controller) model.
Before using a wonderful Laravel, you NEED to set an environment for it. That is difficult and take a while to understand.
So, there are 3 options here as follow:
- Using Homestead
- Using Valet
- Using Laradock — > Highly recommended !!
Option 1: Using Homestead
Homestead is a virtual machine. Then, you will need VMWare or VirtualBox. It provides everything you need to fully develop web with Laravel.
I will not talk in details much in this option since it requires more storage than other options. You can look for more details Here
Option 2: Using Valet
Valet provides a light-weight local development environment that is fast. But it does not support everything. If you want only PHP and MySQL, it is your choice. Important thing is Valet is only for Mac user.
Option 3: Laradock
I am using this option. It is flexible and take advantages of Docker. Before using this option, you should study about Docker (Here). It will significantly help you in web development.
- Install Docker CE
download Docker Community Edition for Mac from Link. You need register in order use Docker.
2. Install Composer
download Composer from Link
3. Create Laravel project via composer
Open a terminal and get to the directory you want to locate. Then, type this command: “composer create-project –prefer-dist laravel/laravel blog “
4. Install Laradock
In terminal, type command: “git clone https://github.com/laradock/laradock.git”
5. Edit your web server in Laradock folder
In terminal, type command: “cd laradock” and then “cp env-example .env”
At line 8, change to APP_CODE_PATH_HOST=../blog/
6. Run the environment
In terminal, type command: “docker-compose up -d nginx mysql”
7. Open your browser
Open your favorite browse and visit http://localhost/. It will display as picture follow:
That is it !
Now, you are ready to use powerful Laravel to develop.
Good luck !
Original Source from: https://medium.com/@thanatornboonnak/setting-laravel-environment-by-laradock-on-mac-c8d53cae52d7
Leave a Reply