how to composer create-project laravel

This guide will help all PHP developers who are looking to try their hands with Laravel on MAC OS.

Laravel, has couple of dependencies and I will not get into all of that, I wanted this installation and setup process to be less complex for any developer reading this and for that have already done lot of research, based on my experience this is the easiest way to get started (there could be more options available with greater minds out there)

Any PHP developer would be familiar with XAMPP, So I would use what we already have installed.

Step 1: Install (Composer)

Point your browser address bar to

Then open Terminal and type bellow to test:

php ~/Downloads/composer.phar --version

Above, command will output as below composer version:

Composer version 1.7-dev (sd2guirofdhdsgjkfg3fsdj4bfdhf) 20xx–00–00 21:36:46

Now let’s copy to bin and install it, with below command:

cp ~/Downloads/composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

Let’s test, if all is good with composer:

composer --version

You should get below output:

Composer version 1.7-dev (sd2guirofdhdsgjkfg3fsdj4bfdhf) 20xx–00–00 21:36:46

Step 2: Create a new Laravel project

While in Terminal, browse where you want to setup your app and run below command:

composer create-project laravel/laravel demowebsite

Note: demowebsite can be any userdefined name of your project

If you are connected over internet, should se as below, this may take a while based on your internet connection speed.

Installing laravel/laravel (v5.6.12)
- Installing laravel/laravel (v5.6.12): Downloading (100%)
Created project in demowebsite
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)

Step 3: Configure virtual host and system host

Browse to, XAAMP/etc/extra/httpd-vhosts.conf open in any text editor and append at the end of file as below:

<VirtualHost *:80>
DocumentRoot “/Applications/XAMPP/htdocs/demo/laravelwebsite/public”
ServerName laravelwebsite.demo

To add entry to system Host, type below command in Terminal:

sudo nano /etc/hosts

Add, laravelwebsite.demo //comment existing one prefixing #

Commands to follow for editing and saving:

ctrl key + 0 //Save
ctrl key + m //To Append
ctrl key + x //To Exit

Once done, now restart Apache server via XAMPP manager.

Important: In order to enable custom virtual hosts to work you need to uncomment below in xamppfiles/etc/https.conf

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf //removing the # before "Include......"

All set, well not really, let’s test what we get in the browser:

Point you browser to http://laravelwebsite.demo

You may encounter this error as below:

The stream or file "laravel/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

Simple and most suggested solution is to allow permission as below:

chmod -R 777 storage //full rights 777

But, wait this is absolutely dangerous to do while you go in production, as this would open doors for hackers to get into and install any script and make your life difficult.

The more secure way suggested to do this is as below:

// changes the owner to be your username and the web server sudo chown -R $USER:_www /pathtolaravel
// find every file "-type f" , every directory "-type d" execute the chmod command to 664 and 775 for both.
sudo find /pathtolaravel -type f -exec chmod 664 {} \; 
sudo find /pathtolaravel -type d -exec chmod 775 {} \;
// changes the owner recursively across the storage and bootstrap/cache folders and gives web server read, write and execute permissions
sudo chgrp -R _www storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

Once the permissions are set successfully, reload the browser address bar pointing to http://laravelwebsite.demo


read more

How To Install the Apache Web Server on CentOS 7

  Introduction The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popu...
read more

Centos 8 with DirectAdmin installation checklist

Purchase VPS, VDS or Dedicated server Purchase DirectAdmin License. You must have to have valid server IP. Login to server with root Begin Installation : DirectAdmin wget Change
read more

Whatsapp Marketing廣告推廣計劃

price package
Whatsapp Marketing廣告推廣計劃 Whatsapp Promotion & Marketing Whatsap 的好處: Whatsapp 訊息, 每個智能手機用戶都一定會看收到的資訊 用Whatsapp 一定有iPhone or Anrodid 的高消費年青群 Whatsapp ...
read more