After some months of work I'm releasing version 1.0 of the following projects:
The goal of these projects is to speed up and simplify as much as possible the development of applications using the recently launched TravelPerk Open API for those application developers who use PHP as their programming language and specially those who use the Laravel Framework.
This projects bundles an HTTP client for making requests, an OAuth2 library for automatically manage the OAuth2 workflow, a JSON Response mapper, and method and type definitions for all the operations and types that are currently on TravelPerk's API.
By using these libraries an application designers can skip most of the official documentation, forget about request headers, refreshing tokens or parsing json responses and instead direcly ask for what they want in their code using an expresive syntax, for instance:
Travelperk::expenses() ->invoices() ->query() ->setCustomerCountryName('Spain') ->setStatus('paid') ->setLimit(10) ->get();
Will return a filtered list of invoices, that would be instances of the Invoice class, so if you are using a smart IDE you'll also get autocompletion while navigating these resources.
If you're application is using PHP with no framework you would just have to install travelperk-http-php using composer, and then initialize it providing your credentials as explained on the Getting Started section.
If instead you are planning to integrate it with your Laravel project then you would have to install laravel-travelperk and follow the configuration instructions to start retrieving data from TravelPerk.
I would also recommend checking the code for this project, that is a full example for building a project that covers 100% of what the TravelPerk API has at the time of writing this, and also how all these operations can be done using these wrappers.
Releasing the 1.0 version means I've achieved the main goal I had when I started this projects, from now I will focus on bug fixing, keeping them to date with the API and occasionally refactor some code, so if you are using them and have some feedback don't hesitate on opening an issue on GitHub and if you find them useful share them or star them on GitHub.