Integrating Cloudinary into CodeIgniter The Easy Way

As I found out on a project just a little while ago, CodeIgniter 3 does not play nice with custom “libraries” that use PHP namespaces and are directly loaded via the “libraries” folder.

This is a problem because several PHP based API services use namespaces both to initialize the library code and to interact with the API.  Case in point: Cloudinary and it’s PHP API library.

If you try to load and use Cloudinary’s PHP library the normal way in CodeIgniter, it breaks due to the heavy use of namespaces both to setup the API connection and throughout the library itself.

To resolve this issue, I wrote an easy to use solution that indirectly loads Cloudinary’s library via a dummy library file.  The API library keeps using it’s namespaces and everything is right with the world again. 🙂

It’s easy to implement and the method will work with any library that makes use of namespaces.

Visit the Project page for a demo or checkout the project on GitHub.

Categories: cloudinary-for-codeigniter | Coding