In order to run this locally you will need the following tools/programs:
- Composer - https://getcomposer.org/download/
- Node / NPM - https://nodejs.org/en/download/
- Cmder - http://cmder.net/ (optional but I highly recommend has git built in, allows for aliases, etc...)
- Git - https://git-scm.com/download/win (not needed if you use cmder as it comes installed)
For php/composer install the following packages globally so they can be used anywhere:
composer global require "phpunit/phpunit"
composer global require "laravel/installer"
If you are using cmder I highly recommend setting up some aliases that will make your life a lot easier.
{CmderDirectory}\config\user-aliases.cmd add the following lines:
gs=git status
aa=git add --all
push=git push
pull=git pull --rebase
test=phpunit
testreport=php -c .\php-xdebug.ini C:\Users\{USERNAME}\AppData\Roaming\Composer\vendor\phpunit\phpunit\phpunit --coverage-html ./storage/logs/phpunit
testu=phpunit --testsuite unit
testf=phpunit --testsuite functional
testa=phpunit --testsuite functional
cleandb=php artisan migrate:refresh && php artisan db:seed
From the project directory you will need to make sure you have all frontend dependencies (npm) as well as backend dependencies (composer). The following commands will need to ran:
composer install
npm install
First you will need to create your local version of your .env file. This goes in the root directory of the
project code. This allows you to set environment variables without having to worry about what web server you
are using. You can copy the contents of /.env.example to your /.env file. Make sure you update your
database credentials to connect to your local database server. Set your database as an empty database then use
migrations to create all tables.
To run database migrations simple run the artisan command migrate from the root directory of the project.
If you want to use seed data run the artisan command db:seed command from the root directory of the project.
php artisan migrate
php artisan db:seed
You have two options for running a web server locally. You can either run the server from the command line or you can use something like WAMP Server (http://www.wampserver.com/en/). I personally use Wamp Server 64bit with PHP 7.0.
From the project directory you will simply need to run php artisan serve. By default it will be running on
localhost:8000, so you should be able to go to http://localhost:8000 in your browser.
First I normally setup a host record for a dev domain name, something like mroc.local. Open up your
windows host file which can be found at C:/Windows/System32/drivers/etc/hosts. Add a line that looks
like this:
127.0.0.1 mroc.local
In your wamp directory look for a directory called /alias, I normally create a vhost in here by creating
a sites.conf file. Mine looks like this:
<VirtualHost *:80>
ServerName mroc.local
DocumentRoot c:/wamp64/www/mroc/public
</VirtualHost>
Modify your DocumentRoot if your code is in a different location. After you have added this make sure you
restart apache for it to pick up the new .conf file. After this you should be able to visit http://mroc.local
in your browser.