POSTS
Legacy Code and Teams Series: Composer
By Carlos Buenosvinos
- 2 minutes read - 230 wordsMy code does not follow PSR-0
I already have a custom autoloader
You may have an existing autoloader that you want to preserve. However, if the previous autoloader trick does not fix your situation, you really have something strange such as classes defined with the same name in different files you load dynamically. My suggestion is to use just one autoloader. So, while you move to composer ;) you may need to live with both autoloaders in your application. Is there an option to do it? Of course! You can achieve this mixing your current “spl_auto_register” and composer’s autoload require famous code line:
I have dependencies directly in my code
I have some dependencies that are not in Packagist
I have some dependencies I cannot update due to own modifications
Bad, bad, bad. This is something you should never do. Try always to extend a library but not to modify it directly. You may get stuck in that version and updates may be imposible to apply. So, the options you have are: move your version to Packagist as the previous tip, try to use the official Packagist version extending the library you are using or take your modifications and make a pull request to library’s owner.
I still use some PEAR libraries
Some of the most typical PEAR libraries have been ported to Packagist. Just search for “pear”.