#2 How to install and run Laravel

Install Laravel on localhost MAMP

# Install composer first https://getcomposer.org/download/
cd ~
laravel                                     # if laravel is installed already then if will show
composer global require "laravel/installer" #Install laravel globally

cd /Users/imransayed/bash
nano exports.sh
# now add this line of code in exports.sh to define the path
alias laravel=/Users/imransayed/.composer/vendor/bin/laravel;

cd /Applications/MAMP/htdocs         # Go to htdocs 
laravel new projectname               # this will install laravel inside htdocs/projectname directory

cd projectname                        # go to projectname directory where laravel would have installed.
php artisan serve                     # This command will start a development server and will give you an ip e.g.
# open the ip it has given on browser and you can see the laravel installation

You can also install it using create-project command like so :

composer create-project -prefer-dist laravel/laravel projectname // -prefer-dist laravel/laravel means install laravel from git repo laravel/laravel

Add your review

Leave a Reply