Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Easily extend your existing
PHP app with an API
in it2PROFESSIONAL PHP SERVICES
Michelangelo van Dam!
!
PHP Consultant
Community Leader
President of PHPBenelux
Contributor to PHP projects
!
T @DragonBe ...
Who builds API’s?
http://apigee.com/about/
How do you build them?
https://www.flickr.com/photos/florianric/7263382550
October 8, 2013
• ZendCon keynote
• MWOP announces Apigility
• REST API Management Tool
Apigility in a nutshell
• Full-features REST mgmt tool
• Versioning
• Authentication
• Validation
• Hypertext Application
...
Legacy applications
Example
Zend Framework1 app
https://www.flickr.com/photos/simonov/3629246570
https://www.flickr.com/photos/npobre/2601582256
Requirements
• Apigility
• A ZF1 project
• Composer
• Some coding experience
https://www.flickr.com/photos/adesigna/4090782...
Approach
Vanilla Apigility!
Skeleton
Your ZF1 App Your ZF1 Libraries
Download Apigility
git clone https://github.com/zfcampus/zf-apigility-skeleton.git zfdemo-api
cd zfdemo-api
php composer.p...
Add Zend Framework 1
vi composer.json
"require": {!
...!
"zendframework/zendframework1": "~1.12"!
}
php composer.phar upda...
Add your app and lib
git submodule add -f https://github.com/in2it/zfdemo.git vendor/zfdemo
git submodule add -f https://g...
Symlink into your app
cd vendor/zfdemo/library
ln -s ../../zendframework/zendframework1/library/Zend Zend
ln -s ../../In2i...
Update index.php
sed -i ’s/APPLICATION_PATH/ZF2APP_PATH/g' public/index.php
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 TH...
Welcome!
https://www.flickr.com/photos/raster/3563135804
https://www.flickr.com/photos/levendis/474847831
Get started!
Get started!
Create new API
Create new API
Create new API
Create new API
Provide a name
Provide a name
Create new REST Service
Create new REST Service
Name the REST service
Name the REST service
Name the REST service
There you go: user API
Modify the user API
Modify the user API
We need the resource class
We need the resource class
Get ZF1for2.php
in2.se/zf1for2
Thank you MWOP & Team!
https://www.flickr.com/photos/juokaz/4702577233
Resources
• The Apgility site: http://apigility.org
• My blog article: http://in2.se/1fVZ2sI
• My github zfdemo: http://in...
https://www.flickr.com/photos/lwr/13442542235
Contact us
in it2PROFESSIONAL PHP SERVICES
Michelangelo van Dam
michelangelo@in2it.be
!
www.in2it.be
PHP Consulting - Trai...
Join the fun!
PHPBENELUX
phpbenelux.eu
https://www.flickr.com/photos/drewm/3191870083
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Nächste SlideShare
Wird geladen in …5
×

Easily extend your existing php app with an api

1.196 Aufrufe

Veröffentlicht am

So you have spent the last few years building PHP applications but now the business requirements have changed and you need to provide a full featured REST API. You could invest time, money and energy building it yourself, but have a look at Apigility. This is a full REST management application build on ZF2 allows you to tap into your existing PHP application and provide 100% REST endpoints to the outside world.

In this talk I go over the challenges we had to deal with creating our own REST implementation, throwing it all away because we only had 20% of the features of Apigility and setting up and managing Apigiltiy using an existing PHP application.

After this talk you will get a good understanding how to use Apigility to manage your REST API’s, while using your non-ZF2 application (Zend Framework, Symfony, Aura, ...). So you can invest time in building more features instead of trying to make your application REST compliant.

Veröffentlicht in: Ingenieurwesen
  • Als Erste(r) kommentieren

Easily extend your existing php app with an api

  1. 1. Easily extend your existing PHP app with an API in it2PROFESSIONAL PHP SERVICES
  2. 2. Michelangelo van Dam! ! PHP Consultant Community Leader President of PHPBenelux Contributor to PHP projects ! T @DragonBe | F DragonBe https://www.flickr.com/photos/akrabat/8784318813
  3. 3. Who builds API’s? http://apigee.com/about/
  4. 4. How do you build them? https://www.flickr.com/photos/florianric/7263382550
  5. 5. October 8, 2013 • ZendCon keynote • MWOP announces Apigility • REST API Management Tool
  6. 6. Apigility in a nutshell • Full-features REST mgmt tool • Versioning • Authentication • Validation • Hypertext Application Language (HAL) supported • API Documentation
  7. 7. Legacy applications
  8. 8. Example Zend Framework1 app
  9. 9. https://www.flickr.com/photos/simonov/3629246570
  10. 10. https://www.flickr.com/photos/npobre/2601582256
  11. 11. Requirements • Apigility • A ZF1 project • Composer • Some coding experience https://www.flickr.com/photos/adesigna/4090782772
  12. 12. Approach Vanilla Apigility! Skeleton Your ZF1 App Your ZF1 Libraries
  13. 13. 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
  14. 14. Add Zend Framework 1 vi composer.json "require": {! ...! "zendframework/zendframework1": "~1.12"! } php composer.phar update
  15. 15. 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
  16. 16. Symlink into your app cd vendor/zfdemo/library ln -s ../../zendframework/zendframework1/library/Zend Zend ln -s ../../In2it/library/In2it In2it cd ../../..
  17. 17. Update index.php sed -i ’s/APPLICATION_PATH/ZF2APP_PATH/g' public/index.php
  18. 18. 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!
  19. 19. Welcome!
  20. 20. https://www.flickr.com/photos/raster/3563135804
  21. 21. https://www.flickr.com/photos/levendis/474847831
  22. 22. Get started!
  23. 23. Get started!
  24. 24. Create new API
  25. 25. Create new API
  26. 26. Create new API
  27. 27. Create new API
  28. 28. Provide a name
  29. 29. Provide a name
  30. 30. Create new REST Service
  31. 31. Create new REST Service
  32. 32. Name the REST service
  33. 33. Name the REST service
  34. 34. Name the REST service
  35. 35. There you go: user API
  36. 36. Modify the user API
  37. 37. Modify the user API
  38. 38. We need the resource class
  39. 39. We need the resource class
  40. 40. Get ZF1for2.php in2.se/zf1for2
  41. 41. Thank you MWOP & Team! https://www.flickr.com/photos/juokaz/4702577233
  42. 42. Resources • The Apgility site: http://apigility.org • My blog article: http://in2.se/1fVZ2sI • My github zfdemo: http://in2.se/1pu7R9b
  43. 43. https://www.flickr.com/photos/lwr/13442542235
  44. 44. Contact us in it2PROFESSIONAL PHP SERVICES Michelangelo van Dam michelangelo@in2it.be ! www.in2it.be PHP Consulting - Training - QA
  45. 45. Join the fun! PHPBENELUX phpbenelux.eu
  46. 46. https://www.flickr.com/photos/drewm/3191870083

×