Jump to content

Is it difficult to make your plugin composer compatible?


CrimpJiggler

Recommended Posts

I notice plenty of CakePHP plugins don't have composer.json files in their github repositories (I'm not sure where composer downloads from if you don't specify a repository, is it github?) so I can't automatically download and update them. For composer to recognise and download the plugins, all thats needed is the composer.js file itself isn't it? Why wouldn't plugin authors just spend an extra 10 minutes and make a composer.js file? I'm guessing theres something I'm missing here, it must not be that simple. I only started using composer so I don't really know what its about yet.

Link to comment
Share on other sites

Just to clarify, Composer files have to be in json format. So you need a composer.json file, not a composer.js. It is json, not javascript code.

Aside from the location of the file, a library really needs to be in a public version control system. The way dependencies work, and for the ongoing development of the library, the author already needs to be somewhat savvy as to how to version the library. You don't for example only want to have a master branch, and have everyone pulling the library from master, if you will be actively updating it, perhaps with new features or changes that will break the old functionality. For that reason, ideally the author should already have a release branch and have version tagged it appropriately. This information all goes into the composer.json file.

 

More about setting up a library is in the composer manual: https://getcomposer.org/doc/02-libraries.md

 

The library also needs to be PSR-0 compatible. See: https://gist.github.com/Thinkscape/1234504

 

PSR-0 insures that libraries will be setup in a structure, and to have used php namespaces so that there won't be collisions, and that composer will be able to build a valid autoloader to make the use of the library functional.

Link to comment
Share on other sites

I'm not sure how Cake "plugins" are designed, but any code installed via composer will be installed into the vendor directory and autoloaded. Would cake plugins support being installed here?

 

The library also needs to be PSR-0 compatible. See: https://gist.github....nkscape/1234504

Not necessarily. Composer supports multiple autoloading strategies including psr-0, psr-4 and class mapping.

Link to comment
Share on other sites

I'm not sure how Cake "plugins" are designed, but any code installed via composer will be installed into the vendor directory and autoloaded. Would cake plugins support being installed here?

 

 

Not necessarily. Composer supports multiple autoloading strategies including psr-0, psr-4 and class mapping.

Hey Tony,

 

Yes, I didn't want to get into all that backward compatibility crap, as I think it only adds to the confusion, so I left it out.

 

You make a good point about the plugins location, and I have to assume that a "composer supported" cakephp would need some special configuration that would add its directory to the number of searchable paths.

 

I know that you and I are in agreement that we avoid the old pre-5.0 frameworks like Cake and CI, and I never cease to be amazed by the fact that we seem to get more questions about them then we do about any of the frameworks we actually like and use.

Link to comment
Share on other sites

I know that you and I are in agreement that we avoid the old pre-5.0 frameworks like Cake and CI, and I never cease to be amazed by the fact that we seem to get more questions about them then we do about any of the frameworks we actually like and use.

I know right... I'm not sure how these projects are kept alive.

 

Just for shits and giggles I have just had a quick look at CakePHP's upcoming 3.0. Starting at the composer file - the first sign that things aren't good. The framework isn't built from loosely coupled components. I've then browsed the "Core" namespace just for fun. My eyes hurt.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.