Mem can be run standalone when the host machine is properly configured, or in Laravel Homestead, where the configuration is done automatically through a Vagrant virtual machine. The instructions below are for running using Homestead Improved, which simplifies the setup process for developing with Homestead.
- VirtualBox
- Vagrant
- Git (Git Tools if on Windows).
-
Set up the Homestead Improved VM. Run the following in a bash-like prompt (on Windows, use Git Bash):
git clone https://github.com/swader/homestead_improved mem cd mem bin/folderfix.sh
-
Set up
etc/hosts
.First, find your
etc/hosts
file. On OS X and Linux it's/etc/hosts
, and on Windows it'sC:/Windows/System32/drivers/etc/hosts
. Add a line like this:192.168.10.10 homestead.app
If you change
homestead.app
to something else, be sure to update thesites
key inHomestead.yaml
to match. -
Clone Mem into
Project
.git clone https://github.com/cyberbit/mem Project
-
Boot up the Vagrant box.
vagrant up
-
Connect to the VM and install dependencies.
From this point on, lines beginning with
$
indicate commands run inside the VM.vagrant ssh $ cd Code/Project $ composer install
-
Configure the project environment.
First, create an environment file:
$ cp .env.example .env $ nano .env
Update
APP_KEY
to something appropriate. The CodeIgniter Encryption Keys section of https://randomkeygen.com works well for this purpose, as Lumen does not provide akey:generate
utility, which is available in full Laravel distributions. -
Configure the database and insert initial data.
$ php artisan migrate $ php artisan db:seed
-
Use the app! Visit
homestead.app
(or whatever host you configured in step 2) in a web browser.To login, click the I'm in button on the homepage, or the Login link in the navigation bar.
- Test email:
test@test.com
- Test password:
$sh4rpspr1nG$
- Test email:
Included in the repository are two files: postman.json
and postman.csv
, a request collection and test dataset for use with Postman.
- Import
postman.json
into Postman as a collection. This will add a collection named "Mem", and set up over a dozen requests spanning all the features of the app (including error handling and authentication). - Add an environment (Manage Environments > Add) and set the
wroot
variable to the web root of the app (homestead.app
by default). Be sure to select the new environment after adding the variable. - Send the
/api
request. If all is well, a friendly greeting should appear in the response window.
The order of commands in the collection is set up for easy unit testing in Postman.
- In Postman, click Runner.
- Select the Mem collection and the Mem environment.
- For Data File, pick
postman.csv
from the repository. - Click Run. Test results will appear on the right hand side of the window.
The source for these tests can be found in the Tests tab of each request.