Lumen: API Development – Episode I
So, this post is about develop your own API using Lumen, a micro framework, a child of the Laravel (I assumed it that way). This topic will take few parts and this is the Episode 1 of Lumen: API Development.
Following tools required to be install on your machine:
- Virtual Box – For those using Avira Anti Virus, you might need to head over this article if you having problem with Virtual Box.
- Vagrant – Enable developers to easily share the same environment configurations
- Composer – Enable developers to manage packages for system dependencies
- Git – Famous version control (please do create a GitHub account)
- Sublime Text 3 – best text editor I’ve used so far. 🙂
Here are the basic steps taken for setting up the Lumen(all commands running in Git Bash):
- Create Lumen project at directory lumen-api
composer create-project laravel/lumen lumen-api
- Install homestead
cd lumen-api
composer require laravel/homestead
- Make homestead
php vendor/bin/homestead make
OR
php vendor/laravel/homestead/homestead make
- Create id_rsa at /C/Users/[yourname]/.ssh
ssh-keygen -t rsa -C [email protected]
- Open Homestead.yaml and change map folder to working directory (step #1)
map: "D:/WWW/lumen-api"
- Update C:/Windows/System32/drivers/etc/hosts file
192.168.10.10 lumen-api.com
- install vagrant laravel/homestead (size about 1GB..taking about 45 minutes on 4mbps connection.. T_T)
vagrant box add laravel/homestead
- Open up Virtual Box & start up the vagrant
vagrant up
- Try to SSH to homestead to check if it’s ok
ssh [email protected] -p 22
- Browse to lumen-api.com to check if the homestead installed properly