Deprecating the "extra" neos loading order in composer.json?


(Bastian Heist) #1

I just stumbled upon this feature in the docs:
http://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/PackageManagement.html#loading-order
“The loading order of packages follows the dependency chain as defined in the composer manifests involved, solely taking the “require” part into consideration. Additionally you can configure packages that should be loaded before by adding an array of composer package names to “extra.neos.loading-order.after” as in this example:

"extra": {
    "neos": {
        "loading-order": {
            "after": [
                 "some/package"
            ]
        }
    }
}

If I’m not misunderstanding this, putting a package in this “after” section is exactly the same as just require-ing it. This poses the question whether we should deprecate and remove this feature as it’s basically redundant. Id like to understand if anyone is actually using this, and if so, why you’re using this instead of just putting the package in “require”. Is that just so I can define packages that should be loaded before, but not actually require them to be installed? Why would I want that?
Cheers,
Bastian


(Christian Müller) #2

Fine for me! :slight_smile:


(Bastian Waidelich) #3

yes please


(Daniel Lienert) #4

Never used it, so :+1:t3:


(Sebastian Kurfuerst) #5

fancy… :smiley: didn’t know that even existed!


(Benjamin Klix) #6

didn’t use it till now, but i can think of one situation someone wants this feature:
If you have an optional dependency that should be loaded before this package if it is in dependencies but ignored if it isn’t.

Don’t know if this case really exists, but this would be the only way i can think of why this “extra” exists.


(Christian Müller) #7

I think that actually was the case it was made for. Something like a choice of different implementations of something but which need to be loaded before a package.


(Rens Admiraal) #8

just found this silent conversation and wanted to drop in that this indeed has the described usecase. There’s multiple actually…

  • allowing to load after optional packages
  • loading after require-dev dependencies (thought at least those were ignored in the package order)
  • loading after package that require your package (rare usecase)

I use this feature always when I want to have a defined order, and even find this a cleaner way then using composer require / require-dev for ordering which don’t really say anything about order.


(Karsten Dambekalns) #9

Well, anything that depends on something else is loaded after that. So it does say something about order.

But optional packages of course are not taken into account, thus this feature is useful.


(Rens Admiraal) #10

Composer itself says nothing about order of packages as far as I know… Using it that way is conventient (and seems to work), but it’s dangerous to only rely on that behaviour.
I can not recall the exact usecase, but at some point I had a requirement that had to be loaded after the package requiring it. I know we agree on this feature being useful, but I want to state this extra clear as it was suggested to be removed… IMHO the ordering on the require should be documented as convenient and probably sufficient, but if you want to be in control: use the extra config…