Improving SendGrid's Open Source Software Development Kit: PHP Edition


June 12, 2018
Written by
Elmer Thomas
Contributor
Opinions expressed by Twilio contributors are their own

Improving SendGrid's Open Source Software Development Kit: PHP Edition

We recently launched the v7.0.0 of our open source SendGrid PHP SDK. This is SendGrid’s 4th largest officially supported open source SDK with over 3.2 million+ installs via Packagist, 800+ GitHub Stargazers, 400+ forks and 90+ contributors. We stayed true to our open source mantra of producing SendGrid led, community-driven libraries. This was a collaborative effort that involved over 14 external contributors.

We followed the same prescription behind the successful updates of our C# and Node.js SDKs. We hope that our PHP specific journey inspires some ideas that help on your next collaborative upgrade adventure.

When the Developer Experience team was formed a few years ago, one of our largest tasks was to update our 7 official supported SDKs to support v3 of the SendGrid API (some of that story and lessons learned can be found at DevRel.net). Here, I’ll constrain the story to our beloved PHP SDK.

Step 1: Minimize Dependencies

The first order of business was to update the PHP HTTP client so that we were no longer depending on a third party PHP HTTP client. For v2 of the SendGrid API, we depended on Guzzle, which is an excellent PHP HTTP client.

As more great PHP frameworks came on the scene, we were seeing increasing issues related to Guzzle incompatibility issues.

Similar issues were happening across our other SDKs, so we made a strategic decision to remove all dependencies if it made sense from each SDK (read how we did this for our PHP SDK).

Step 2: Automate

Next, we needed to automate coverage of the now 233+ endpoints that v3 of the SendGrid API supports. The prior SDK only supported the mail endpoint which, you guessed it, is our key endpoint that supports sending email.

Part of that story can be found here, which describes how we lean on Stoplight.io, Stoplight.io’s Prism and an open sourced OpenAPI specification to drive our automation.

Step 3: Proposing Our Community-Driven Design

Finally, we wanted to handcraft a getting started experience that makes it feel natural to execute the most common SendGrid API use cases in PHP. This v7.0.0 release realizes the beginning of that vision.

When we first started rewriting this SDK to support v3 of the SendGrid API, we posted messaging on GitHub (in bolded red font, no less) and did not receive much feedback. So we developed the rewrite largely in-house. This was not ideal, but we needed to get support for the v3 SendGrid API out the door, so we proceeded.

This time, we practiced some document driven development and created a proposal of what the new design should look like. We then tagged our key contributors in a GitHub issue to request help on developing a final design for v7.0.0 of the PHP SDK. Those steps led to spirited and intelligent collaborations that helped us create a design that we feel best serves our PHP open source community. We hope you enjoy it!

Of course, this is just day one of our PHP journey and we can’t wait to see what use cases come up next and how our SDKs continue to evolve along with the community. To participate, join us on GitHub and browse and/or create issues and PRs. We would love to work with you!

Recommended For You



Most Popular


Send With Confidence

Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.