php-zalando, a PHP client to interact with the Zalando API
Again it’s been a while since I created a public PHP library to interact with another API but here we go. For a project we needed to interact with Zalando but unfortunately their API didn’t have a PHP wrapper/library to interact with it. Until now!
I present you php-zalando (packagist link) based on the Zalando API.
API endpoints covered so far
- https://api.zalando.com/article-reviews
- https://api.zalando.com/article-reviews/{reviewId}
- https://api.zalando.com/article-reviews-summaries
- https://api.zalando.com/article-reviews-summaries/{articleModelId}
- https://api.zalando.com/articles
- https://api.zalando.com/articles/ {articleId}
- https://api.zalando.com/articles/ {articleId}/media
- https://api.zalando.com/articles/ {articleId}/reviews
- https://api.zalando.com/articles/ {articleId}/reviews-summary
- https://api.zalando.com/articles/ {articleId}/units
- https://api.zalando.com/articles/ {articleId}/units/{unitId}
- https://api.zalando.com/brands
- https://api.zalando.com/brands/{key}
- https://api.zalando.com/categories
- https://api.zalando.com/categories/{key}
- https://api.zalando.com/domains
- https://api.zalando.com/facets?{filters}
- https://api.zalando.com/filters
- https://api.zalando.com/filters/{name}
- https://api.zalando.com/recommendations/ {articleIds}
Nearly all API endpoints are covered, but there are still some items to do:
– achieve 100% code coverage (34% at the moment)
– add all optional filters/parameters, different per endpoint
Installation
Via Composer
Add php-zalando in your composer.json or create a new composer.json:
{ "require": { "cschalenborgh/php-zalando": "dev-master" } } |
Now tell composer to download the library by running the command:
php composer.phar install |
That’s it! Because of Composer’s autoloading you should now be able to use this library. Don’t forget to include the namespace.