Better support for PHP
See original GitHub issueCan you add better support for PHP?
This should include better composer.json
handling.
The current version only links normal dependencies. But it should also link extension dependencies (ext-*
) to correct documentation page on PHP documentation website. Suggested dependencies in suggest
section should also be linked correctly.
It should also link name
field to package on Packagist (but don’t then forget to fix #45), autoload
and autoload-dev
sections to correct directories and bin
section to correct file.
Composer’s composer.json
file is similar to Node’s package.json
so you could take some code from there. You should also look to composer.json
schema for reference.
There should also be parsing of PHP files.
First, it should link require
, require_once
, include
and include_once
to correct files. This is similar to Node, except that it can be used with or without brackets.
It should also link use
statements. This is a bit different because it includes namespace instead of the file. But with autoloading, program then includes correct file. In this case, this extension should somehow “extract” correct file from namespace and link it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
When you parse
composer.json
and autoloader it’s not such mess 😁Anyway, I found an easy solution that works for most cases without parsing
composer.json
. It still removes the first part of namespace if not found, but also checks if current file namespace is included in a required namespace. This probably means that both namespaces are in the local project.This should work for most projects, but it still doesn’t support third-party dependencies. To support them, the program would need to use some external API which would parse all project files.
I created PR #52.
@fiatjaf Ok, I can do this. I’ve already started doing this and I will ask you if I will need some guidance or help.
For
composer.json
, I will probably take some code frompackage.json
parser. And forrequire
, I will also take some things from Node. Foruse
, it could maybe use some external API which would convert namespaces to packages. But I will see if I can do something like this.