{"action":"closed","issue":{"url":"https://api.github.com/repos/composer/composer/issues/4369","repository_url":"https://api.github.com/repos/composer/composer","labels_url":"https://api.github.com/repos/composer/composer/issues/4369/labels{/name}","comments_url":"https://api.github.com/repos/composer/composer/issues/4369/comments","events_url":"https://api.github.com/repos/composer/composer/issues/4369/events","html_url":"https://github.com/composer/composer/issues/4369","id":102647340,"number":4369,"title":"Use case question: Different require clauses by repo user.","user":{"login":"Canta","id":3045938,"avatar_url":"https://avatars.githubusercontent.com/u/3045938?v=3","gravatar_id":"","url":"https://api.github.com/users/Canta","html_url":"https://github.com/Canta","followers_url":"https://api.github.com/users/Canta/followers","following_url":"https://api.github.com/users/Canta/following{/other_user}","gists_url":"https://api.github.com/users/Canta/gists{/gist_id}","starred_url":"https://api.github.com/users/Canta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Canta/subscriptions","organizations_url":"https://api.github.com/users/Canta/orgs","repos_url":"https://api.github.com/users/Canta/repos","events_url":"https://api.github.com/users/Canta/events{/privacy}","received_events_url":"https://api.github.com/users/Canta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/composer/composer/labels/Support","name":"Support","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-23T19:01:32Z","updated_at":"2016-02-20T18:57:41Z","closed_at":"2016-02-20T18:57:41Z","body":"Hi there. \r\n\r\nI have this use case in my project, and don't know what's the best way to face it. I'm looking for advise, please tell me if this isn't the place for questions like this.\r\n\r\nI'm working in a project that consists of a core software, and multiple add-ons (plugins).\r\nThis is a Laravel app, and i decided from the start to handle package management using Composer.\r\n\r\nI want to be able to update the app instances by using composer. The company i'm working for uses Subversion, and we have added our private repos to the project's composer.json file. So far, everything's fine: when the user clicks \"update\" on the UI, the new code for the core is updated using subversion, and composer handles requirement updates. \r\n\r\nBut there's a catch: we sell different functionalities at different prices. That is, our customers buy the core at a price, and they can also buy different plugins at an extra price. So, we don't just give all the app's plugins, but manage access to them (to the code itself of the plugins) by customer. \r\nFor that access, we're using subversion credentials: user A has access to plugins 1,2,and 3, while user B has access to plugin 1 and 6, and so on. This way, if somewhere in the future a user decides to buy a plugin, we can give them access to it by simply changing permissions in the repos, and he/she just have to press \"update\" in the UI. Composer handles this by using REQUIRE clauses that point to the plugins, which have their own separate repos.\r\n\r\nProblem is: if i put a generic composer.json file for the core, how do i tell composer to check for this or that other REQUIRE dependency based on the customer's access?\r\n\r\nTo the day, what we've done is to alter every installation's \"composer.json\" file in order to match the customer's current plugin setup. That is: hardcoding the requires in the composer.json file (either programatically using the command line \"--require\" argument or just by editing the json file at setup time). But that will get us to SVN conflicts with that non trivial file the day we wanted to add/remove/change some core dependency, breaking the update proccess. And this app is installed around the whole country: we can't just go and change every installation, the changes has to be carefully planned and compatible with a programable update process.\r\n\r\nI was looking for a way of using a second JSON file just for the plugins, so i can have that one outside the project repo and recreated by looking at the repo access, while the \"composer.json\" file is used for the core and is repo managed. But AFAIK that mechanism doesn't exists. There's of course the option of different repos for different customers, which i simply refuse to mantain. And there are other slightly different options, all which end in an edited \"composer.json\" file.\r\n\r\nWe're thinking alternatives, but all of them point to just get composer out of the way and handle app requirements on our own, as the way composer has of living with composer.json doesn't seems to play nice with Subversion. I don't want that, i'm betting on our ignorance: there has to be some way of using composer we (my team) just don't know yet. \r\n\r\nMy best bet so far is to just take out of the project the main \"composer.json\" file and programatically recreate it as part as the update process, doing all the checks i had to do before that. But if i do that, i just feel there's no use in Composer anymore, as i'm doing checks at least twice. My second best bet is to just modify Composer code to fit our needs, which may be a lot of work and we don't have the luxury of time.\r\n\r\nSo, what do you people think is the best way of doing this with composer? Is it even possible?\r\n\r\nThanks.\r\n"}}