Phinx: Missing yaml parser, symfony/yaml package is not installed.

Created on 8 Apr 2020  Â·  13Comments  Â·  Source: cakephp/phinx

We're using Phinx in a plain PHP project with no other dependencies. After Phinx update to v 0.11.6 we get an error: "Missing yaml parser, symfony/yaml package is not installed.". Seems like Phinx misses YAML dependency.

support

Most helpful comment

I don't get it. Why symfony/yaml became a dev dependency when YAML is still the default config format? So, now after installing and initializing phinx by following the installation instructions from docs, everybody gets this error on trying to create a migration? It doesn't make sense. I didn't even know that we could use other formats until now. Am I missing something?

All 13 comments

It was moved to a require-dev dependency.
https://github.com/cakephp/phinx/releases/tag/0.11.5

This should have probably done in the 0.12 major instead of the minor.
But please read the respective PR/change for details here.

We use Phinx as a dev dependency for our project. Probably due to this fact, YAML is not installed and Phinx crashes.

Jep, thats proably it.
Please add those packages into your root requirements to solve this.
Sry for the hickup here in that minor release.

I don't get it. Why symfony/yaml became a dev dependency when YAML is still the default config format? So, now after installing and initializing phinx by following the installation instructions from docs, everybody gets this error on trying to create a migration? It doesn't make sense. I didn't even know that we could use other formats until now. Am I missing something?

@slepic
As author of https://github.com/cakephp/phinx/issues/1702 what do you think here?
I would also expect this to fallback to a supported format, if yaml is not available. Is this not the case right now?

Feels like there's three options:

  1. Make symfony/yaml required again, leave yml as default format
  2. Make symfony/yaml optional, use yml as default if it's installed, else use php (or json)
  3. Make symfony/yaml optional, always use php (or json) as default

My vote would be for option 3 as the least surprising behavior as I'm not sure there's a way to detect if symfony/yaml was installed due to some other package, or if it was expressly installed for phinx.

We could do this for 0.12 now as we are early in the cycle and this would sure ease the requirements overhead and allow this to be a true opt in format if wanted.

If you go with option 3, the documentation will also need to be updated.

Hey guys, my personal opinion is that option 3 should be preferred as those formats (php,json) are really what you have available if you dont opt in for yaml (and making it default always seems more consistent - you probably dont want someone who uses default, suddenly needs yaml package for a different part of his app, now breaking his phinx config because default changed to yaml as he installed the package). Now not opting in for yaml, means no default, which is uncomfortable to say at least. Should I say that if I were to choose between php and json, I'd choose php, as that one in fact has the strongest expressive power and is truly native to the language (as it is the language itself), while json, although present in php compilation by default, can also be opted out. If json was default, there should really be check for ext-json and if that is not installed (although unlikely), make php default anyway.

Yes it would be a breaking change, but it already was when yaml was made optional. Those who upgraded probably already dont use default as either they already did not use default format or all they had to do was to use yaml format explicitly. Only resulting in more installations not using default format. The further change will then only influence those who did not upgrade yet (so it will when they do), but they would be influenced by the previous break anyway (if they use default format).
And so it actualy is not going to worsen things any further. But it is going to be cleaner to have default the php format which is the only one of them that is truly always going to be available.

I stumbled across this today, if you make option 3 the default ./vendor/bin/phinx init needs to create a _PHP_ file instead of a _YAML_ file.

I understand that you wanna get rid of a dependency by moving to plain php, but all the documentation on the cakephp website and that I've found so far is using YAML, so I don't know what a php configuration would look like with all the %%OPTIONS%% etc, etc. I think this change was half baked. You broke a lot of stuff without much explanation and have no way to migrate one to the other, and no documentation updates to reflect that.

I had played around with moving all the docs to PHP as part of #1794, but then backed out since I liked the slight sucicentness of the YAML examples compared to PHP. Rewriting it to PHP is probably preferable though given its the default format, and it's probably more likely that someone using phinx has experience in PHP and recognize on how to read a PHP complex array versus YAML, and then also the translation from PHP -> JSON / YAML is simpler than YAML -> PHP / JSON.

Anyway, created a new issue, #1923, to track this.

The project changes the default language from yaml to php, nowhere does it document that you should install symfony/yaml and the documentation is left in a language which isn’t the default? That’s extremely confused.

It doesn’t matter if yaml is a super nice language to read, what matters is that the docs are consistent with the default expectations of the project. Especially so since the defaults are not even possible to do with the fact that yaml won’t be installed by default.

If yaml is so lovely, then keep yaml as the default and revert the projects default back to yaml. One or the other, but you can’t put your feet on both sides of the fence, that’s kind of ridiculous.
On 11. Nov 2020, 18:28 +0100, Matthew Peveler notifications@github.com, wrote:

I had played around with moving all the docs to PHP as part of #1794, but then backed out since I liked the slight sucicentness of the YAML examples compared to PHP. Rewriting it to PHP is probably preferable though given its the default format, and it's probably more likely that someone using phinx has experience in PHP and recognize on how to read a PHP complex array versus YAML, and then also the translation from PHP -> JSON / YAML is simpler than YAML -> PHP / JSON.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

Was this page helpful?
0 / 5 - 0 ratings