Confused about laminas-zendframework-bridge

The laminas-zendframework-bridge readme states: (emphasis added)

This package should be installed only if you are also using the composer plugin that installs Laminas packages to replace ZF/Apigility/Expressive packages.

However per my composer.lock I can see that it is required by laminas-escaper, laminas-feed, and laminas-stdlib.

So seems that it will be installed no matter what. Is that intended? If so perhaps the readme should be updated.

I’m looking into it because it appears to be the culprit of an autoloading error that I’m helping someone out with.

Yes, this is by design, for example https://github.com/laminas/laminas-servicemanager/blob/3.4.1/composer.json#L36

If you have migrated a project to laminas/* components, it is still unclear if you have references to Zend\* symbols within your codebase, nor in any of the dependencies.

The dependency will be dropped in the next major release of these components.

Perhaps the readme should be updated then? Current wording makes it seem like a mistake that it is installed.

Hey,

brandonkelly
September 8

Perhaps the readme should be updated then? Current wording makes it seem like a mistake that it is installed.

Sure, feel free to send a patch. I think “should be installed only” could be something like “should be explicitly required only”

What does “the composer plugin” refer to? Composer itself, or do you have an actual Composer plugin that extends Composer functionality?

Hey Brandon,

I have no idea what you are referring to, from the context of this discussion. I suggest you open a discussion directly on a pull request, where the context is more clear :slight_smile:

Context is I’m submitting a PR to clarify the readme, but want to make sure I fully understand what it is saying first.

It currently says: (emphasis added)

This package should be installed only if you are also using the composer plugin that installs Laminas packages to replace ZF/Apigility/Expressive packages.

I’m trying to understand what “the composer plugin” refers to here, as Composer does have its own concept of plugins that extends the base functionality. For example, https://github.com/yiisoft/yii2-composer

The laminas-zendframework-bridge is two pieces of functionality:

  • A configuration post-processor for Laminas MVC and Mezzio applications, to rewrite service names referencing ZF namespaces to the new ones in Laminas packages.
  • A composer plugin that hooks into autoloading to intercept requests to load ZF classes and instead create a class_alias to the Laminas equivalent, if one exists.

So, the README should say something along the lines of “This package should only be installed if you are using third-party packages that still consume Zend Framework/Apigility/Expressive code.”

At the moment I think the problem has nothing to do with Craft CMS or laminas-zendframework-bridge or laminas-feed. The problem lies much earlier: