News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Cal Evans:
Using 3rd party libraries in Composer projects
July 22, 2013 @ 09:37:53

In this new post to his site, Cal Evans shares a handy tip for those using non-Composer libraries in a Composer-friendly project - using classmaps to bridge the gaps.

A problem I ran into when starting this project is that the official MailChimp API wrapper for PHP is NOT a Composer package. Thankfully, the wizards behind Composer have thought this through. To facilitate using non-Composer packages in composer projects, all I had to do is add one line to my "autoload" section of my project.

Using this "autoload" section, you can get Composer to add the path as a namespace to the class mapping. This lets it load them up in the same way i would any other PSR-0 formatted package. This will even work if you have libraries that aren't PSR-0 as it finds all of the files and pulls them into the map automatically.

0 comments voice your opinion now!
composer project thirdparty library psr0 autoload classmap

Link: http://blog.calevans.com/2013/07/21/using-3rd-party-libraries-in-composer-projects

blog comments powered by Disqus

Similar Posts

Matthew Weir O'Phinney's Blog: Phly_Struct? no, Phly_Hash...

Lukas Smith's Blog: Remember: be nice to byte code caches

Sebastian Bergmann's Blog: On PHPUnit and Software Metrics

Edin Kadribasic's Blog: PHP 4.4.4-win32 with MySQL 5.0.22

Pádraic Brady: Composer: Downloading Random Code Is Not A Security Vulnerability?


Community Events





Don't see your event here?
Let us know!


framework package laravel interview community api release introduction series opinion voicesoftheelephpant list deployment symfony language podcast tips bugfix library install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework