18 Dec 2015 • BLOG - News
Mailjet’s New JAVA and PHP Clients Make Integration Easy For All
18 Dec 2015
We’re so excited to share that we recently launched a new version of our JAVA and PHP API clients. This new update allows developers to fetch data directly from the API with a lighter internal code-style. We wanted all users – experts and beginners to be able to easily pick up the wrapper internals and contribute or change the code to fit their needs.
We’ve also integrated Travis in both wrappers for unit tests, It’s an automated test runner for our git repositories, so you can confidently make pull requests without breaking the existing implementation, stay up-to-date with wrapper states and also make sure you are working with a stable version of the API Client.
Why we decided to iterate on our first version
Now, we’ve scaled this process down to only two lines of code, making it more accessible for all:
Leveraging the Open Source community was also one of our goals. of this new update. We used the Google Http Client Library via a Java community project, and the well known Guzzle Http library for PHP. This will ensure our API client will be available on Google Cloud services, is maintained by the community, and focuses on simplicity.
For example, here’s how you would get a contact in Java:
We love our developer community and encourage you guys to contribute as much as you want! We already go a lot of interest from the Github community and some amazing contributions on both wrappers, and we will be happy to review your work!
We also wanted to give beginners, students and Hackathon attendees a way to quickly send email without having to worry about anything else than their application rather than the email itself:
In Java, sending an email can be performed through the MJEasyClient class.
In PHP, it’s almost the same:
What does this all mean?
On the internals, both PHP and Java now have a much simpler, more consistent code that’ll make it easier for you, our community to contribute and work together in. With this new update, our wrappers are now designed with the most popular guidelines in the industry. For example, we used namespaces, autoload and PSR style guide for PHP. It also means you’ll be able to get the clients and their dependencies with popular dependency managers such as Composer in PHP and Maven in Java. We can’t wait to see what you build with the updated clients!