Make a Lasting Impression
ImpressCMS Blog > Composer Integration Experiments

Composer Integration Experiments

Composing ImpressCMS
I'm currently doing a series of experiments with my limited PHP development experience to integrate the composer package management into the ImpressCMS core. This is very PHP-specific hardcore stuff so I'm learning a lot as I go along. I'm not a newbie when it comes to dependency resolution from my Linux time, so I already got the basics. The specific implementation in composer and the design choices made by the team, along with getting to know a complete new ecosystem of packages and tools is really interesting!

My main reason for this approach is that composer is the de facto standard for php package distribution. Package discovery, package installation, dependency resolution and version management are all functionalities that we will need in short order in the ImpressCMS core.

It can be a very complex matter, so it's smart to look out for a proven solution to integrate in ImpressCMS, certainly where looking at functionality that is not really part of the core CMS functionality.

In similar circumstances, having composer integrated in the core (and the composer autoloader scripts as well) will make it much easier to integrate external libraries, and will (hopefully) lead to more cool stuff to come out in the near future.

Many content management systems pride themselves on their extensibility. I believe it's a smart approach. The core team can't take care of all the different specific needs and libraris that people want to integrate for their projects. Let's just make it easier for people to integrate their library of choice into the core.

Done

At the moment, these things are already done:

  • A composer plugin specifically for the installation of ImpressCMS packages is available on github: https://github.com/ImpressCMS/compo ... ler-plugin
  • A temporary test repository running on Satis for ImpressCMS composer packages is available now at http://beta.impresscms.org/packages. Contact me to add a composer-enabled ImpressCMS module to it.
  • The development branch of the profile module is composer enabled, and installs without a problem on a clean ImpressCMS installation.

Things still to do

  • A lot
  • making composer autoload work in all cases in the core
  • figuring out how to transform the current impresscms autoloader class into composer directives, so we can switch to using the composer-generated file.
  • moving the external libraries from the 'libraries' folder to composer dependencies. Adapting the core code where necessary.
  • testing how to add external dependencies in modules

I'm currently doing this in my own fork of the core, as this is more of an experiment and I don't want to pollute the official repository with my composer quests.

However, if you feel this is worth pursuing and you want to help me out to get faster to a state where it can be integrated into the next main release, let me know what you can do to help.

All posts by fiammybe
Subscribe to latest posts
The comments are owned by the poster. We aren't responsible for their content.
Poster Thread
skenow
Posted: 2014/10/2 2:35  Updated: 2014/10/2 2:35
Home away from home
Joined: 2007/12/4
From:
Posts: 4237
 Re: Composer Integration Experiments
One thing we did when we moved to 1.3 - we made the core autoloading. But, we didn't accommodate other libraries and how to autoload them. Finding the sweet spot and maintaining a path forward could prove tricky.

Just what makes a module 'composer-ready'? I see you've commented the Profile module is, but I don't see anything different in its development branch that would make it so.
fiammybe
Posted: 2014/10/2 11:23  Updated: 2014/10/2 11:23
Home away from home
Joined: 2009/3/3
From: Belgium
Posts: 1944
 Re: Composer Integration Experiments
making a module 'composer ready' in it's simplest form is adding a composer.json file to the module main folder, which describes the module and it's dependencies.

In the current state of affairs, that composer packages should then be added to the repository on http://beta.impresscms.org/packages

If you want to make use of the autoloader that is generated automatically by composer for all packages, that might be a bit more working through the code, but that's not yet done.
debianus
Posted: 2014/10/5 17:40  Updated: 2014/10/5 17:40
Home away from home
Joined: 2007/12/4
From: Spain
Posts: 1281
 Re: Composer Integration Experiments
Great!