-
Install Vagrant on your machine (http://vagrantup.com)
-
Run
vagrant up -
Access the vagrant image via:
vagrant ssh -
Install the dependencies for the sample application via
cd /vagrant ./composer.phar install bundle install
-
Create the user & database
createuser -Upostgres -hlocalhost -s vagrant createdb -Upostgres -hlocalhost laravel_sample_app_development createdb -Upostgres -hlocalhost laravel_sample_app_test -
Install migrations
php artisan migrate:install php artisan migrate:install --env=testing -
Migrate and seed the database
php artisan migrate --seed php artisan migrate --seed --env=testing
php artisan server --host <eth0 IP address if youre using vagrant>
Laravel has a default console - tinker - but it's not very nice. Use boris instead:
php artisan boris
> User::all();
- We have created a separate database
laravel_sample_app_testfor which all tests. Please don't use your development database for tests. We achieve this by creating an additionaltestingenvironment that can be accessed from artisan via the --env=testing flag.
We're using Codeception for our specifications. To run all the tests, execute:
./codeception.phar run
You can specify a particular suite:
./codeception.phar run unit
- In order to debug a test do refer to the setup step debugging of this documentation.
-
Acceptance tests drive the Firefox browser on the host machine, they have been setup for that. To start acceptance tests, firstly run the selenium server on the host machine, the provision script would of downloaded it into the
scriptsfolder.user@host-machine $ java -jar scripts/selenium-server-standalone-2.35.0.jar -
On vagrant, run your app in the test environment on port 3444
vagrant@vagrant-ubuntu-raring-64:/vagrant$ php artisan server --host 10.0.2.15 --port 3444 -
On vagrant, start the acceptance tests
vagrant@vagrant-ubuntu-raring-64:/vagrant$ ./vendor/bin/codecept run acceptance
- Feature specs will be like acceptance but without going through an actual server (like using Rack driver for capybara). This is how codeception does things, so best we just follow
- woodlings... you need one of these before generating
We have created a screencast to help with getting started with step debugging.
There are different parts to setting up step debugging for PHP. We will need to
- Make sure xdebug is setup on vagrant and working properly
- Setup a browser extension that will help signalling to xdebug that the debugger session should be started
- Have an xdebug-client that will be able to speak to xdebug session
- The Vagrant provision script would of setup our xdebug for remote debugging in our ubuntu box.
-
Xdebug only enables itself when it receives the right flag in a request.
-
To easily enable and disable debugging, install Xdebug helper
-
When you enable debugging, the server will break rightaway and try to connect to your xdebug client, so only turn it on if you actually want to debug.
- Install from its homepage
- Set break points from within the code by making a call to xdebug_break()
-
Install Vdebug for remote debugging on your hostbox Vim instance. Copy the following into your plugin_config.vim. Change "/Users/mohan/Projects/laravel_sample_app" to where the root of project is on your machine, restart your vim and run :BundleInstall (This uses vundle, if you're using neo vim-config you're fine)
Bundle 'joonty/vdebug.git' let g:vdebug_options= { \ "port" : 9000, \ "server" : 'localhost', \ "timeout" : 20, \ "on_close" : 'detach', \ "break_on_open" : 0, \ "continuous_mode" : 0, \ "ide_key" : '', \ "path_maps" : {'/vagrant' : '/Users/mohan/Projects/laravel_sample_app'}, \ "debug_window_level" : 0, \ "debug_file_level" : 1, \ "debug_file" : "/tmp/vdebug.log", \ "watch_window_style" : 'expanded', \ "marker_default" : '⬦', \ "marker_closed_tree" : '▸', \ "marker_open_tree" : '▾' \} -
I'll write a longer HOWTO use guide. For now though the plugin docs are pretty well written.
- We use Basset for asset compilation.
- There's a configuration file in
app/config/packages/jasonlewis/basset/config.phpthat specifies the directories it'll compile. - To add new scss or coffescript files to the project, put them in
app/public/stylesheets/andapp/public/assets/javascripts/respectively.
-
Add new dependencies to
composer.jsonand then run./composer.phar update -
(optional) Add any new dependencies and vendor at the same time
./composer.phar require davejamesmiller/laravel-boris dev-master
-
Install phpenv -
https://github.com/phpenv/phpenv-
You may need to
brew install bison gd. If so, you will need to link itbrew link bison --forcebecause it overwrites the system install. -
Compile php with Postgres support. Modify
./phpenv/etc/php.#.#.PLATFORM.sourceto include:--with-pgsql=/usr/local/bin/pg_config --with-pdo-pgsql=/usr/local/bin/pg_config
-
-
Install composer curl -sS https://getcomposer.org/installer | php
-
Create a new Laravel project
./composer.phar create-project laravel/laravel PROJECT_NAME --prefer-dist
OR
You can run off of edge by simply cloning https://github.com/laravel/laravel/ and creating a master branch.