The experience while I installed Laravel:
-
Usual terminal commands:
Here is a list of common commands:
- ls
- list files and directories
- cd
- change directory
- mkdir
- create a new directory
- cp
- copy files or directories
- mv
- move (rename) files or directories
- rm
- remove files or directories
See the Terminal Commands category for a list of useful Terminal programs.
-
The process:
mkdir laravel in MAMP folder —>
1)install composer firstly:
Run this in your terminal to get the latest Composer version:
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 installer script will simply check some php.ini settings, warn you if they are set incorrectly, and then download the latest composer.phar in the current directory. The 4 lines above will, in order:
- Download the installer to the current directory
- Verify the installer SHA-384 which you can also cross-check here
- Run the installer
- Remove the installer
WARNING: Please do not redistribute the install code. It will change with every version of the installer. Instead, please link to this page or check how to install Composer programmatically.
locally run composer
Installing Composer locally is a matter of just running the installer in your project directory. See the Download page for instructions.
The installer will just check a few PHP settings and then download composer.phar
to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.
Now just run php composer.phar
in order to run Composer.
You can install Composer to a specific directory by using the --install-dir
option and additionally (re)name it as well using the --filename
option. When running the installer when following the Download page instructions add the following parameters:
php composer-setup.php --install-dir=bin --filename=composer
Now just run php bin/composer
in order to run Composer.
Basic usage of composer
For our basic usage introduction, we will be installing monolog/monolog
, a logging library. If you have not yet installed Composer, refer to the Intro chapter.
Note: for the sake of simplicity, this introduction will assume you have performed a local install of Composer.
composer.json
: Project Setup
To start using Composer in your project, all you need is a composer.json
file. This file describes the dependencies of your project and may contain other metadata as well.
3. process image of installing the composer
4. The command to install laravel using composer
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer create-project
command in your terminal:
composer create-project --prefer-dist laravel/laravel blog
In my case : I need to use
php composer.phar
create-project --prefer-dist laravel/laravel blog