Open Riari opened 7 years ago
I have implemented just the basics of a possible pr for this.
Is this sufficient?
I forgot on the screenshot, it was me asking for Illuminate\Log\Writer
.
It might be nice to respond with the laravel.com/api
URL rather than the link on GitHub because it makes it easier to navigate around the class. You haven't submitted the PR so I can't check the code though π
Suggested either, but I think it would be nice if it worked with GitHub URLs primarily so that it can be used for projects other than Laravel (Lumen, Illuminate itself, Symfony, etc). Perhaps Eve could respond with multiple URLs where applicable?
@mdavis1982 indeed i haven't, i'm just checking before i submit it :). If i would specify what it should answer, wouldn't create a lot of switch cases?
@Riari yes, i think it should answer github primarly. I will see what i can do, could you give me an example where it could return more than 1 URL?
@PlayMa256 just realised I never responded to this, sorry :D basically I was thinking of something like this:
@eve link me Illuminate\Log Eve says: On GitHub: https://github.com/illuminate/log On Laravel API Docs: https://laravel.com/api/5.3/Illuminate/Log.html On Packagist: https://packagist.org/packages/illuminate/log
So I guess it would require multiple responders/response types to be configured.
Aim
A way for Eve to provide links to API docs and/or files on GitHub based on a given namespace.
Syntax
Example fetching an Illuminate class:
Eve would respond to a link to one of the following:
Development Requirements
Depending on what exactly we want Eve to respond with, this can either be driven by the Packagist API or a defined set of documentation sites where URLs to specific classes can be constructed easily. Both have their benefits and caveats:
Packagist API π Can find any package where the name can be matched π Matching package names using the namespace is tricky and won't always work, so that may warrant having two args:
<package> <namespace>
π May require reading any given package'scomposer.json
to determine the PSR standard used and the root directory for its namespaceAPI docs π Easy construction of URLs for hosted API docs that follow the namespace convention for their URLs π Requires defining sites π Potentially requires handling small differences in URL structure such as version numbering
Nice To Have
link me (api docs for) <namespace>