sendgrid/sendgrid-php — pull request #33 by kander (2013-08-08 14:07:17+00:00)
Title: SendGrid_loader was matching classes not part of it's library

The Autoloader wasn't strict enough in which classes would trigger it.

I'm using the API class together with SendGrid-PHP-Library (because that one offers the Newsletter API not offered by this class). The autoloader was matching code for the other library as well. It would then try to require the file, which would fail.

I've made the matching stricter. Either the class being loaded must be exactly 'SendGrid', or the class must start with 'SendGrid\' (including the namespace). This used to be a preg_match, but was just as easily done using a stripos, which is faster.

An even better, but more time-consuming, solution would be making the library PSR-0 compliant. In that case, we could remove the custom autoloader completely.