building apis with apigilty and zend framework 2

33
Welcome to php[world] 2015 Wifi: SSID: Sheraton_Conference user: php2015 pass: sheraton Twitter: #phpworld Rate talks on joind.in https://joind.in/event/phpworld2015 Building APIs with Apigility and ZF2

Upload: david-stockton

Post on 19-Jan-2017

715 views

Category:

Technology


1 download

TRANSCRIPT

Page 2: Building APIs with Apigilty and Zend Framework 2

Building APIs with Apigility and ZF2

PHP [World]

David Stockton

Page 3: Building APIs with Apigilty and Zend Framework 2

Who Am I?• David Stockton

• VP of Technology, i3logix (Denver, CO)

• Developing PHP for ~17 years

• @dstockto

• http://davidstockton.com

• http://tddftw.com

Page 4: Building APIs with Apigilty and Zend Framework 2

Built with Apigility

Page 5: Building APIs with Apigilty and Zend Framework 2

• USB Drives contain Apigility skeleton and sqlite database

• Copy the apigility zip or tgz and db to your computer. You need PHP 5.4.8 or greater on your computer or a VM.

• Pass the drives on to the next person when copying is done

• Please return them to me when everyone has a copy

Page 6: Building APIs with Apigilty and Zend Framework 2

Other Software• REST tester

• DHC in chrome

• POSTman

• Advanced Rest Client

• PAW

• Httpie

• Curl

Page 7: Building APIs with Apigilty and Zend Framework 2

Why build APIs?

Page 8: Building APIs with Apigilty and Zend Framework 2

Why not build APIs?

Page 9: Building APIs with Apigilty and Zend Framework 2

Content Negotiation

Page 10: Building APIs with Apigilty and Zend Framework 2

HTTP Method Negotiation

Page 11: Building APIs with Apigilty and Zend Framework 2

Versioning

Page 12: Building APIs with Apigilty and Zend Framework 2

Validation

Page 13: Building APIs with Apigilty and Zend Framework 2

Authentication

Page 14: Building APIs with Apigilty and Zend Framework 2

Authorization

Page 15: Building APIs with Apigilty and Zend Framework 2

Documentation

Page 16: Building APIs with Apigilty and Zend Framework 2

Discovery

Page 17: Building APIs with Apigilty and Zend Framework 2

What can we do?

Page 18: Building APIs with Apigilty and Zend Framework 2
Page 19: Building APIs with Apigilty and Zend Framework 2

Apigility is opinionated

Page 20: Building APIs with Apigilty and Zend Framework 2

Content NegotiationJSON / JSON+HAL

Page 21: Building APIs with Apigilty and Zend Framework 2

HTTP Method Negotiation

GET, POST, PUT, PATCH, DELETE, OPTIONS

Page 22: Building APIs with Apigilty and Zend Framework 2

Versioning *supported*

Page 23: Building APIs with Apigilty and Zend Framework 2

Validation *supported*

Page 24: Building APIs with Apigilty and Zend Framework 2

Authentication *supported*

Page 25: Building APIs with Apigilty and Zend Framework 2

Authorization *supported*

Page 26: Building APIs with Apigilty and Zend Framework 2

Documentation *supported*

Page 27: Building APIs with Apigilty and Zend Framework 2

Discovery HATEOAS via HAL

Page 28: Building APIs with Apigilty and Zend Framework 2

H - HypermediaA - AsT - The E - EngineO - OfA - ApplicationS - State

Page 29: Building APIs with Apigilty and Zend Framework 2

HAL - Hypermedia Application Language

Page 30: Building APIs with Apigilty and Zend Framework 2

{ "_links": { "self": { "href": "http://phpcoder.ninja/api/user/dstockto" } } "id": "dstockto", "name": "David Stockton" }

Page 31: Building APIs with Apigilty and Zend Framework 2

Let’s get started!

Page 32: Building APIs with Apigilty and Zend Framework 2

php -S 0.0.0.0:8181 -t public/ public/index.php

Page 33: Building APIs with Apigilty and Zend Framework 2

Please rate this tutorial: https://joind.in/14821