Laravel is a php web framework which following the model–view–controller (MVC) architectural pattern. It is gaining more and more popularity nowadays.
It is almost followed Ruby on Rails framework pattern, not only for MVC structure but also for the pattern that Rails adopt for doing various tasks. It uses composer that installs the software snippets you needed to achieve a particular task as Rails does it with bundler to pick gems.
The drawback of Laravel is it cannot achieve the power of Ruby like meta-programming through php. So I need to write some more code in Laravel and its actually feels irritating if you want to write less code without the same repetitive patterns and keep it DRY.
Get and install composer
Goto (https://getcomposer.org/) Click download.
Run the following:
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
This will install ‘composer.phar
‘ in the current directory.
Move that to bin folder to get it globally available as a command and rename it to composer
$ mv composer.phar /usr/local/bin/composer
Open new tab and Type
$ composer
Install Lareval
Using composer
$ composer create-project --prefer-dist laravel/laravel blog "5.4.*"
From laravel/laravel github repo OR via larval installer
$ laravel new blog
-bash: laravel: command not found
Install it:
$ composer global require "laravel/installer"
this makes it globally accessible
Make sure to place the $HOME/.composer/vendor/bin
directory (or the equivalent directory for your OS) in your $PATH
so the laravel executable can be located by your system.
Open ~/.bash_profile OR ~/.bashrc
in Mac
and add the following line:
export PATH="$PATH:$HOME/.composer/vendor/bin"
save and exit
Open New tab type:
$ laravel
Laravel Installer 1.4.1
Usage:
command [options] [arguments]
Check Laravel version:
$ php artisan --version
Laravel Framework 5.4.27
You are ready to go!