Hi all! Now that PSR-4 is passed I can talk about this again without people thinking I'm trying to derail PSR-4. ;)
There are probably other paths we can follow as well, but I've listed three potential options for how to move forward with the idea of some sort of resource location stuff for (a|) future possible PSR(s).
Classpath Resources
This PSR proposes the use of autoloader configuration metadata as a means for addressing resources that may represent any type of file.
The general idea here being that we add the notion of a classpath to PHP. Prior art on this would be Spring Framework's ability to access non-class resources using the same conventions you would you to "find" a Java class.
In short, this would add "classpath" to the vocabulary of PHP developers and give it meaning. I've worked on a few ideas for this. Here is one of them:
Simple PSR-4 based examples:
Given a classpath comprised of a PSR-4 configuration with a namespace prefix Foo\Bar and a directory src, the following is an example of addressing namespaced resources:
\Foo\Bar\Baz\Qux.php => src/Baz/Quz.php
\Foo\Bar\Resources\config\services.json => src/Resources/config/services.json
\Foo\Bar\Resources\public\logo.png => src/Resources/public/logo.png
I'd really like to see this concept represented as a standalone idea/concept. It would allow developers to take this concept and run with it. For example, Bernhard already took this basic idea and created some really cool higher level concepts on top of this underlying idea. What else could people come up with if they started to play with these ideas?
There would be a relatively low barrier to entry. Implementing this at the autoloader level would be pretty trivial. The concept is super simple and people can start working with it right away. This was a huge deal in any discussion of including resource location in PSR-4... people were adamant about being able to be a classloader without having to be a resource locator. Likewise, I'd like people to be able to build simple solutions based on autoloader metadata without requiring people to implement a full fledged resource locator.
One of the downsides I've heard about this approach is that there is no "API" for using it. With autoloaders, the autoloader is the way that you would interact with this. How will anyone use this? Why would Drupal, Laravel, or Symfony care? Just saying something is possible is not terribly compelling if there is no path to how it can be used or implemented.
Note: It would NOT be based on PSR-0 or PSR-4 or reference the any other way than by example. The examples could very easily just be in the meta document.
Resource Locator Interface
The general idea being closer to what Bernhard built on top of my original lower level resource locator stuff:
In fact, one of the schemes for Bernhard's interface was listed as "classpath://" which was raw access to the autoloader metadata.
The benefits to this is that it *provides* an interface and gives people a way to use it out of the box.
The downsides I see to this is that it has been extremely controversial. There are going to be a lot of people wanting to specify how the interface should be built, what it needs to be able to do out of the box, and how the schemes and namespaces should be handled and defined. I don't really want to wait a year or two to be able to start using this in my projects. :)
I do like this approach, but I also do not want the classpath stuff buried in a full fledged resource locator interface such that the only way someone can actually use the ideas being classpathed resources is by buying into an untested interface entirely.
Classpath => Resource Locator Interface (and optionally a separate classpath scheme)
My preferred approach would be to define and flesh out PSR Classpath Resources in such a way that people can start using it as a concept sooner rather than later. I would expect a few lightweight and simple resource locator implementations and interfaces to crop up.
After that we can then focus on fleshing out a broader PSR Resource Locator like what Bernhard proposed.
We can either add classpath as a scheme and reference the Classpath Resources PSR or we can create a PSR specifically to add the classpath scheme to the resource locator. This would allow the actual resource locator to remain decoupled from the classpath resource PSR and have a lightweight PSR that can easily be superseded to link them together.
The benefits here would be that we can get everything we want but roll it out in pieces.
The downsides to this are that some people seem to have an aversion to having PSRs reference each other. I've never had an issue with this when it makes sense to do so.
All in all, I'm really just excited to get this moving forward. If everyone agrees that we should just focus on a resource locator interface I'm all for it. I'd like to discuss the classpath stuff further, though, to make sure we aren't missing an opportunity there.