Laravel is one of popular framework to build applications in PHP. There are many reasons, why it’s popular that’s another topic of discussion. In this article, I will help the community on how to setup Laravel in Mac.
Requirements to install Laravel:
• PHP version between 5.6.4 & 7.1.*
• OpenSSL PHP Extension
• PDO PHP Extension
• Mbstring PHP Extension
• Tokenizer PHP Extension
• XML PHP Extension
With above requirements, Laravel utilizes composer to manage dependencies. Install composer first.
Guide you how to setup Laravel and composer in macOS.
Composer installation Steps:
Step 1 :- Open terminal
Step 2 :- Run below Commands
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" - php composer-setup.php - php -r "unlink('composer-setup.php');" - php composer-setup.php –install-dir=bin
Now check if composer is installed successfully by using ‘composer’ in terminal.
NOTE : If Composer Not Found then Move composer file in bin directory using below command
=> mv composer.phar /usr/local/bin/composer
Step 3: Now we will install Laravel
1) Go to your MAMP directory (Applications/MAMP/htdocs) using
“cd /Applications/MAMP/htdocs/” command in terminal
2) Run command “composer create-project laravel/laravel laraveltest”. It will take some time to load composer repositories and update dependencies.
3) In command type ‘laraveltest’. Laraveltest will be the project name or you can change it the project name.
Step 4:- After successfully installing go to your browser and enter url:
http://localhost/laraveltest/public
Step 5: Remove “Public” from URL (http://localhost/laraveltest)
1) Move .htaccess from public to root folder.
2) Rename server.php to index.php in root folder.
Voila !!! You just installed Laravel framework on Mac !!! If this was not successful and need more help, please mention your issues in comment section and we will try to assist you.
cmsMinds is a PHP web development agency based in Raleigh,NC with expertise in cms and custom application development. Contact us today!
Good post!
It worked nicely. Thank you
*I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.
Thanks Gon 🙂
great stuff