Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run Mozart on a composer.json that has platform requirements locked to an older PHP version? #95

Open
Luc45 opened this issue Nov 30, 2020 · 6 comments

Comments

@Luc45
Copy link

Luc45 commented Nov 30, 2020

Our plugin is compatible with PHP 5.6+. To make sure all our dependencies are also compatible with these PHP versions, we have specified a platform requirement in composer.json:

"config": {
  "platform": {
    "php": "5.6.20"
  }
},

However, Mozart requires PHP 7.2, and as far as I understand, it must be placed in the same composer.json as the one being prefixed.

I can't just run composer update --ignore-platform-reqs to install Mozart because then the PHP version check step will be skipped when resolving my dependencies, installing libraries that are not compatible with PHP 5.6.

Can I use Mozart on a plugin that has PHP platform requirements such as this one?

@coenjacobs
Copy link
Owner

Yeah, this is something that might be classified as kind of an oversight from my end. I don't think there is a way you can work around this, right now. Mozart might be better off as one of the developer tools, that aren't tied to the project in its composer.json as it directly affects the dependencies that your project actually requires.It also sparked some ideas for resolving the issues raised in #79. I'm going to need some time to properly think things through and consider my options.

@Luc45
Copy link
Author

Luc45 commented Nov 30, 2020

Awesome, thanks for the reply, @coenjacobs.

Please feel free to close this issue.

@coenjacobs
Copy link
Owner

@Luc45 I will not close it, as it is a valid issue. Mozart is currently not able to deal with these kind of situations all too well. It's actually one of the main issues that I've tried to explain in #96 now, where I'm discussing the future of Mozart. I do not have an immediate solution for this specific issue, but I am very much keen on solving it in the nearby future.

@BrianHenryIE
Copy link
Contributor

@Luc45

I think I've got a solution for you –– I've created a mozart.phar to use without requiring Mozart in your composer.json. I does still read its config from your project's composer.json, and does still need PHP 7.2 to run, but since it's outside your project it should still work.

Please try:

curl -OL https://github.com/BrianHenryIE/mozart/releases/download/v0.6.0-bh/mozart.phar
php mozart.phar compose

You should be able to put that inside your "post-install-cmd" to download and run each time.

PR #105 would make an official build on each Mozart release.

@Luc45
Copy link
Author

Luc45 commented Dec 16, 2020

@BrianHenryIE that looks great, thank you!

I've already moved on to another solution, but if I try this out I'll post here the results. Either way, this was a very necessary PR for other people as well.

@coenjacobs
Copy link
Owner

@Luc45 The above PHAR release that @BrianHenryIE mentioned is now merged into master and released as part of the 0.7.0 release. You basically have three options since release 0.7.0, to install Mozart without affecting the dependencies of the project itself:

  1. Use the Docker container as part of your build process
  2. Use the PHAR file added to each release from now on
  3. Install Mozart as a global dependency on your machine (if that's where you're building your projects)

All three work the exact same, as in that you still configure them in your projects composer.json file. It's just different in how you run them. Please let me know how this works out for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants