Create a gist now

Instantly share code, notes, and snippets.

Embed

Building Modern APIs in Expressive

This tutorial has hands-on components where you can actually code along with me. You will get the most out of the session if you do this.

Firstly download the resources for this tutorial from https://akrabat.com/stuff/2018-02-08-SunshinePHP-API-tutorial.zip

To work with the code, you need:

  • PHP 7.1+
  • SQLite
  • Composer

If you have these installed on your computer, then you can run:

$ unzip 2018-02-08-SunshinePHP-API-tutorial.zip
$ cd api
$ php -S 0.0.0.0:8888 -t public/

Alternatively, you can use the supplied Vagrantfile to create a virtual machine that contains all the requirements.

  1. Install dependencies

  2. Unzip 2018-02-08-SunshinePHP-API-tutorial.zip to a folder

  3. Using your terminal change directory to the folder you created by unzipping.

  4. Start the VM with vagrant up

In either case, you will edit the source files on your host machine using your PHP IDE or editor of choice. You may find it helpful to create a project for the api folder.

As a bonus, you can collect pp from [https://akrabat.com/stuff/pp]9https://akrabat.com/stuff/pp) if you are working with curl outside the Vagrant VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment