entheologist Posted August 7, 2014 Share Posted August 7, 2014 I want to install this package: https://github.com/composer/installers from GitHub, I can easily git clone it but I think its better I get experienced with composer. In the readme they onyl give one example, one involving CakePHP: { "name": "you/ftp", "type": "cakephp-plugin", "require": { "composer/installers": "~1.0" } } but I that isn't much help to me since I'm not making composer.json files to hold a single framework or plugin, my json files look more like this: { "name": "example-app", "require": { "cakephp/cakephp": ">=2.5.1", "cakephp/debug_kit": "2.2.*", "slywalker/boost_cake": "*", "CakeDC/tags": "1.*", "CakeDC/utils": "*", "CakeDC/migrations": "*", "FriendsOfCake/crud": "*", "CakeDC/search": "*", "paulredmond/chosen-cakephp": "*" }, "config": { "vendor-dir": "Vendor/" }, "extra": { "installer-paths": { "app/Plugin/Tags": ["CakeDC/tags"], "app/Plugin/BoostCake": ["slywalker/boost_cake"] } } } Right now I'm working on a WordPress one and it is 10 times longer than that. So what I was wondering is if its better to split it up into a few composer.json files. As in one file for setting up the framework and configuring it, when its done, it calls a second composer.json file that will take care of installing the plugins. Like this I suppose I could store a bunch of composer.json files in a central location, each of them has a specific purpose, so if I need to use one of them for a project, I just call composer.phar file (which I can access globally), and use that global keywork to make the json file operate like its in my projects directory. I don't understand what this autoload thing is about at all, but its nice the way it lets you run scripts at particular times during the execution of the json file. Is this actually a better way to work with composer, by chaining separate composer.json files together? A big issue is the name conflict thing, is there a way to make composer.phar process files with different names? It be a pain in the ass having to make the scripts alter the filenames. That gets me thinking about something. Can we define variables in composer.json files? If not, I suppose its not very hard to do it anyway by editing the file. I was thinking there that a composer file generator would be pretty useful. Like say on CakePHPs website, theres a page that lets you check plugins and features that you want for your new installation, then it makes a composer.json file for you. Quote Link to comment https://forums.phpfreaks.com/topic/290335-im-confused-about-composer-and-repositories/ Share on other sites More sharing options...
trq Posted August 8, 2014 Share Posted August 8, 2014 You can only have one composer.json file per project. Requiring multiple composer.json files makes no sense. What are you trying to do exactly? If you want to install this: https://github.com/composer/installers, you simply need to add "composer/installers": "~1.0" to the "require" section of your existing composer.json file and then run `composer.phar install` Or, you can have composer add the line and install for you all in a single step: composer.phar require 'composer/installers:~1.0' Quote Link to comment https://forums.phpfreaks.com/topic/290335-im-confused-about-composer-and-repositories/#findComment-1487160 Share on other sites More sharing options...
trq Posted August 8, 2014 Share Posted August 8, 2014 Oh, and... I don't understand what this autoload thing is about at all See: http://au1.php.net/manual/en/function.spl-autoload-register.php http://www.php-fig.org/psr/psr-0 http://www.php-fig.org/psr/psr-4 https://getcomposer.org/doc/04-schema.md#autoload Quote Link to comment https://forums.phpfreaks.com/topic/290335-im-confused-about-composer-and-repositories/#findComment-1487162 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.