pimp legacy php apps with apigility - truenorthphp 2014
TRANSCRIPT
![Page 1: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/1.jpg)
Pimp legacy PHP apps with Apigility
TrueNorthPHP 2014
in it2
![Page 2: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/2.jpg)
Michelangelo van DamConsultant, Community Leader, Contributor
http
s://w
ww.
flick
r.com
/pho
tos/
akra
bat/8
7843
1881
3
![Page 4: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/4.jpg)
How do you build them?
http
s://w
ww.
flick
r.com
/pho
tos/
floria
nric
/726
3382
550
![Page 5: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/5.jpg)
October 8, 2013
• ZendCon keynote
• MWOP announces Apigility
• REST API Management Tool
![Page 8: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/8.jpg)
Apigility in a nutshell• Full-features REST mgmt tool
• Versioning
• Authentication
• Validation
• Hypertext Application Language (HAL) supported
• API Documentation
![Page 9: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/9.jpg)
![Page 10: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/10.jpg)
http
s://w
ww.
flick
r.com
/pho
tos/
sim
onov
/362
9246
570
![Page 12: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/12.jpg)
http
s://w
ww.
flick
r.com
/pho
tos/
npob
re/2
6015
8225
6
![Page 13: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/13.jpg)
Requirements
• Apigility
• A ZF1 project
• Composer
• Some coding experience
http
s://w
ww.
flick
r.com
/pho
tos/
ades
igna
/409
0782
772
![Page 14: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/14.jpg)
ApproachVanilla Apigility!
Skeleton
Your ZF1 App Your ZF1 Libraries
![Page 15: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/15.jpg)
Download Apigility
git clone https://github.com/zfcampus/zf-apigility-skeleton.git zfdemo-api
cd zfdemo-api
php composer.phar self-update!php composer.phar install
![Page 16: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/16.jpg)
Add Zend Framework 1
vi composer.json
"require": {! ...! "zendframework/zendframework1": "~1.12"!}
php composer.phar update
![Page 17: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/17.jpg)
Add your app and lib
git submodule add -f https://github.com/in2it/zfdemo.git vendor/zfdemo
git submodule add -f https://github.com/in2it/In2it.git vendor/In2it
![Page 18: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/18.jpg)
Symlink into your app
cd vendor/zfdemo/library
ln -s ../../zendframework/zendframework1/library/Zend Zend
ln -s ../../In2it/library/In2it In2it
cd ../../..
![Page 19: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/19.jpg)
Update index.php
sed -i ’s/APPLICATION_PATH/ZF2APP_PATH/g' public/index.php
![Page 20: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/20.jpg)
Run Apigility
php public/index.php development enable
php -S 0.0.0.0:8888 -t public public/index.php
DO NOT RUN IT LIKE THIS IN PRODUCTION!
![Page 21: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/21.jpg)
Welcome!
![Page 22: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/22.jpg)
http
s://w
ww.
flick
r.com
/pho
tos/
rast
er/3
5631
3580
4
![Page 23: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/23.jpg)
http
s://w
ww.
flick
r.com
/pho
tos/
leve
ndis
/474
8478
31
![Page 24: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/24.jpg)
Get started!
![Page 25: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/25.jpg)
Create new API
![Page 26: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/26.jpg)
Create new API
![Page 27: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/27.jpg)
Provide a name
![Page 28: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/28.jpg)
![Page 29: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/29.jpg)
Create new REST Service
![Page 30: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/30.jpg)
Name the REST service
![Page 31: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/31.jpg)
There you go: user API
![Page 32: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/32.jpg)
![Page 33: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/33.jpg)
Modify the user API
![Page 34: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/34.jpg)
We need the resource class
![Page 35: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/35.jpg)
![Page 36: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/36.jpg)
![Page 38: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/38.jpg)
![Page 39: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/39.jpg)
![Page 40: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/40.jpg)
Thank you MWOP & Team!
http
s://w
ww.
flick
r.com
/pho
tos/
juok
az/4
7025
7723
3
![Page 41: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/41.jpg)
Resources
• The Apgility site: http://apigility.org
• My blog article: http://in2.se/1fVZ2sI
• My github zfdemo: http://in2.se/1pu7R9b
![Page 42: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/42.jpg)
joind.in/12722
Slides will be made available there. !
If you enjoyed this talk, thanks! If not, let me know how I could improve it
![Page 43: Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014](https://reader034.vdocuments.mx/reader034/viewer/2022051516/55d5782ebb61eb9a2f8b45a0/html5/thumbnails/43.jpg)
http
s://w
ww.
flick
r.com
/pho
tos/
drew
m/3
1918
7008
3