question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better support for PHP

See original GitHub issue

Can 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:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
filips123commented, Jul 14, 2019

Oh, there are third-party dependencies imported in the same manner? Great, what a mess!

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.

1reaction
filips123commented, Jun 17, 2019

@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 from package.json parser. And for require, I will also take some things from Node. For use, it could maybe use some external API which would convert namespaces to packages. But I will see if I can do something like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Most Popular PHP Frameworks to Use in 2022 - Kinsta
Everything you need to know about PHP frameworks: why you should use one, which ones are best for beginners and the most popular...
Read more >
11 Best PHP Frameworks For Beginner to Pro Developers
This article will help you find the best PHP framework for web development. We will go over the 11 best PHP frameworks and...
Read more >
10 Best PHP Frameworks For Savvy Web Devs In 2022 - Rollbar
What is a PHP framework? Why use a PHP framework? Best PHP frameworks; Laravel; Symfony; CodeIgniter; CakePHP; Yii; Zend; Phalcon; FuelPHP ...
Read more >
Get Long-Term Support for PHP 5.6, 7.1, 7.2, 7.3, and 7.4
ZendPHP includes 24/7/365 support from a global team of PHP experts, with two-hour support responses, critical security patches, bug fixes, and more.
Read more >
Top Code Editors and IDE for PHP Development - Cloudways
Netbeans Aptana Studio Eclipse Sublime Text Atom Notepad++ Coda Brackets SlickEdit jEdit Komodo Edit RJ TextEd
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found