PHP Wrapper for Adegga.com API
If you are going to build an application using Adegga.com API this post is for you. I just created an API Wrapper in PHP for a few CoreFactor projects.
Just include two files into your PHP code and start coding away. The main class holds the helper functions (more to come as they become available).
It’s a very simple wrapper for now but it should be updated as soon as the API becomes stable.
You can fork it here:
https://github.com/corefactor/Adegga-PHP-API-Wrapper
Official Adegga API documentation is available here:
http://www.adegga.com/help/api/
Example Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | require('adegga_core.php'); require('adegga.php'); $adegga = new Adegga('YOUR_API_KEY'); # GET PRODUCER $producer = $adegga->getProducerByID(16); var_dump($producer); # MANUAL EXAMPLE $wine = $adegga->get('GetWineByAvin', array('AVIN6452997073019')); var_dump($wine); # HELPER FOR THE EXAMPLE ABOVE $wine = $adegga->getWineByAvin('AVIN6452997073019'); var_dump($wine); |
if you want to use the internal cache, just instantiate like this:
1 | $adegga = new Adegga('YOUR_API_KEY', MY_CACHE_FOLDER); |
The default life time of the cached files is 1 hour, if you want to change it:
1 | $adegga = new Adegga('YOUR_API_KEY', MY_CACHE_FOLDER, '+1 day'); |
