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

Andrew Embler:
Q&A: Using Composer in a concrete5 Package
Aug 21, 2015 @ 16:30:46

Andrew Embler has posted a guide to his site showing you how to use Composer with concrete5 to integrate third party libraries quickly and easily. concrete5 is an open source content management system under the MIT license and is flexible and easy to extend.

Let's say I'm creating a statistics package and I want to use LavaCharts in it. For those who don't know, LavaCharts is a PHP library that abstracts Google's JavaScript Chart API to PHP. Instead of writing JavaScript, you build your charts with object-oriented PHP. It's nice. LavaCharts is available through Composer, so I'll include it that way.

He uses this particular package as an example, showing you how to create the composer.json file to include the LavaCharts library and run Composer to install it. He then shows the integration of the package with the concrete5 CMS instance, including the Composer autoloader in the "on start" handling. From there it's just a matter of referencing the library via its namespace and using it to populate and generate the resulting chart.

tagged: composer lavacharts tutorial integration library package concrete5 cms

Link: http://andrewembler.com/2015/08/q-using-composer-concrete5-package/


Trending Topics: