RESTful API for Web/Mobile App
- PHP >= 5.4
- MCrypt PHP Extension, for Yosemite, see here
- Composer, for Mac, see Installing Composer on OS X. For Windows, see Installation - Windows
- Clone the repository, for Mac, clone it to
~/Sites/l5-app
. After that, switch to thedevelop
branch. - Run the
composer install
command under the project root~/Sites/l5-app
. This command will download and install the framework's dependencies. Avoid usingcomposer update
command since it will update framework's dependencies to their latest version.
- Install VirtualBox and Vagrant.
- Add the box to your Vagrant, run
vagrant box add laravel/homestead
. It will take a few minutes to download the box. - Install the Homestead CLI tool using the Composer, run
composer global require "laravel/homestead=~2.0"
. - Add
export PATH=~/.composer/vendor/bin:$PATH
to your~/.bash_profile
so the homestead executable is found when you run the homestead command in your terminal. - Run
homestead init
to create theHomestead.yaml
configuration file, then runhomestead edit
to edit the yaml file. The yaml file should look like below for our project:--- ip: "192.168.10.10" memory: 2048 cpus: 1 authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa folders: - map: ~/Sites to: /home/vagrant/Sites sites: - map: l5-app.dev to: /home/vagrant/Sites/l5-app/public databases: - homestead - l5-app variables: - key: APP_ENV value: local
- Make sure you have a SSH key, check by running
ls -al ~/.ssh
. If not, generate a new one usingssh-keygen -t rsa -C "your_email@example.com"
. - Edit your
hosts
file to add the domain. Runsudo vim /etc/hosts
, add this line192.168.10.10 l5-app.dev
to the file. - Start homestead by running
homestead up
, after that, you should now see the welcome page by go to http://l5-app.dev/.
See more details about Laravel Homestead here.
- Use
homestead ssh
to ssh into the VM, go to the project root by runningcd ~/Sites/l5-app
. Usephp artisan migrate
to run all migrations, then usephp artisan db:seed
to seed the tables. - You can use Sequel Pro to easily connect to the database. Download Sequel Pro.
- Add a standard connection in Sequel Pro with the following details:
Name: l5-app-local Host: 127.0.0.1 Username: homestead Password: secret Database: l5-app Port: 33060
See more details about Migrations & Seeding here.
Although Laravel Homestead comes with Node.js, it doesn't work very well. We will install Node.js on our local machine.
- Download and install Node here.
We will use Bower for our front-end package management.
- Go to the project root by running
cd ~/Sites/l5-app
, install Bower usingsudo npm install -g bower
. - Run the
bower install
command under the project root. This command will download and install all package dependencies.
- Go to the project root by running
cd ~/Sites/l5-app
, pull inGulp
as a global NPM package, runsudo npm install --global gulp
. - Install Elixir by running
sudo npm install
. - Now you can use
Gulp
commands to watch or compile SASS/LESS files, see the list of commands here.
See more details about Laravel Elixir here.