User Validation with ZeroBounce

Knack has undergone some pretty astonishing changes in the last few years. Our team has grown, our problems have grown, our technology stack has grown, and of course, our user base has grown. One of the big issues, when your app or service starts to take on some serious user-activity, are the issues that follow with user growth. Chances are if you have scaled an application before, you know that these users with illegitimate emails find their way into the system.

To solve this problem, we built some tools to assist in user validation. One of the most important parts of user validation for Knack was building out an email validation service. We compared each of the email validation services available to us and had even at one point had considered using a hand-crafted validation service for our users. After some deliberation, it was determined that this was a situation where big data could really help out. In our comparison, 6 different services were evaluated: ZeroBounce, SendGrid, NeverBounce, Mailgun, Kickbox, and BriteVerify. Ultimately, in terms of features available and pricing, ZeroBounce was the clear winner. ZeroBounce was feature-rich sporting all of the checkmarks we were looking to get and also inexpensive compared to the other services that were available.

After deciding to run with ZeroBounce for our email validations, now it was time to integrate their service into our backend. At Knack, our API is running on PHP and Laravel. ZeroBounce had a pre-made solution that was a basic wrapper around the ZeroBounce API for PHP but was nothing too fancy. Our biggest concern was that this package didn’t provide us with Laravel Service Providers to integrate directly with Laravel. It was time to create our own API wrapper.

In creating this wrapper, there were a few constraints that we wanted to cover:

  1. Support Laravel or Vanilla PHP - whether you wanted to integrate with Laravel Service Providers or just require the API Wrapper class in a vanilla PHP project, we wanted PHP developers to quickly get started with our package, no matter what the environment.
  2. 100% Use Case Coverage - our culture at Knack recently has become “test early, test often”. This package was no exception to that rule. We wanted to provide as much testing as possible to prove to ourselves that we covered all of our edge cases. Even though we didn’t hit 100% test coverage, we covered all of the methods and edge cases that we knew were important for this package.
  3. Open-source our package! - Knack has been meaning to open-source some of our software for a while and this highly-useful package seemed to be the perfect entry point into the open-source community.

We built a ZeroBounce package that fits all of those constraints and we are excited to announce that we are open-sourcing this package for the community to use! Check out our repo here on Github or our link to the package on Packagist. We’d love to hear if there are any improvements you have for us and are accepting PRs.

Happy coding everybody.