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

Extract factories #26

Closed
sagikazarmark opened this issue Dec 14, 2015 · 3 comments
Closed

Extract factories #26

sagikazarmark opened this issue Dec 14, 2015 · 3 comments

Comments

@sagikazarmark
Copy link
Member

Unfortunately guzzle/psr7#50 hasn't been accepted which made me think about the current state of factories and discovery.

Currently we have all our Factory implementations in the discovery repo, which makes the actual implementations nearly unusable in cases where the discovery layer is not needed.

IIRC @mekras suggested a while ago to separate the factories from the discovery layer. Although we refused to do (I don't remember the reasons, probably to many packages and dependencies?) we should reconsider this. I see three possible ways:

  1. Leave it as is.

  2. Separate factories to implementation specific packages and

    A. require the implementation itself as well
    B. only suggest the implementation

In case of "A" we cannot really use the factories automatically anymore in the discovery layer, but we have to install them manually, based on the chosen implementation.

In case of "B" we can require all the factory packages in the discovery layer, so we could use it as usual. Although in this case we also install lots of extra dependencies.

@dbu
Copy link
Contributor

dbu commented Dec 15, 2015

the message factories interfaces are defined in message-factories. but
the implementation lives here together with discovery.
for Httplug, the interface is defined in httplug, the implementation
live in adapter.

complicated. what if we move message factories that we know of into the
message-factories repository? that would make more sense to me.

separating the factory implementations into their own repo, but then
require them from discovery seems complicated. yeah, if i don't want
discovery i can require them separately.

i think my order of preference is:

  1. move factory implementations into same repo as interfaces
  2. move them to a separate repository and require them
  3. move them to separate repository per implementation (guzzle,
    diactoros) and require all of them
  4. leave as is

@sagikazarmark
Copy link
Member Author

Maybe we could move the factory implementations to utils. It is for library implementors anyway.

Also, we don't even have to require it in the discovery package. We just need to check for the Factory and the Message existence. In this case the discovery package can purely be a discovery layer. We can place a warning, that to use our factories, the utils package should also be installed.

@dbu
Copy link
Contributor

dbu commented Dec 16, 2015 via email

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

2 participants