Welcome to the Code Path Finder.

This is my free time project that indexes PHP repositories on GitHub with their dependencies (if any) and presents them through simple API. There is about 20K indexed repositories. Dependencies are resolved for every commit and every PHP file in the repository is indexed (if parsed successfully). References are generated in respect to the originating commit and repository. For example, if repository X references some function from repository Y, reference consists of repository, commit, originating file and fully qualified name. You can check an example of the API response on /zlikavac32/php-enum/blob/master/src/Enum.php.json

Here are some current stats:

Commits Full Failed Partial
6,099,345 4,892,314 (80.21%) 945,628 (15.50%) 261,403 (4.29%)
Files Succeeded Failed
9,912,805 9,856,998 (99.44%) 55,807 (0.56%)

Frontend is provided through the Chrome extension and Firefox extension. Currently it can remap PHP files and diffs of PHP files on GitHub and provide cross-repository navigation.

Now, some words about indexing. Files are parsed using nikic/php-parser and traversed to collect symbol declarations (database contains around 29M of them right now). For every commit dependencies are resolved and unknown repositories from GitHub are queued to be indexed. Types are resolved from type hints and PHPDoc comments. JetBrains/phpstorm-stubs is used as the PHP environment. New changes are fetched every day or two. Because of that, branches may produce unexpected responses if the system does not yet have the newest changes.

What are plans for the future?

  • Switch to HTTPS
  • Support different sources like GitLab
    • Requires that extension also knows about new source
  • Provide self hosted variant
  • Assist on merge requests
  • Document API
  • Infer types from expressions (return ... ? new A() : new B();)
  • Collect extra metadata like PHPDoc comments and expose them through API
  • Explore integration of graph database like Memgraph for more complex queries
  • Some heuristics for fetching new changes (how/when to queue)
  • Explore switching to Rust for a lot of backend processing
  • ... a lot of stuff

Why? I really miss the ability to browse through the PHP code on GitHub (or other hosting sites) and click on a reference which would redirect me to the declaration. I know where it should be (mostly) but why not automate that process? This is helpful when checking the code before including it as a project dependency. Currently the best options that I know is to download it, open it up in the IDE and browse from there.

Other thing that bugs me is context switch during the code review. Chances are that I'm locally not on the branch that I should review, and I would really like to navigate to a method that's being called. Right now I have to stash my changes, checkout that branch and navigate from there.

Some other notes. This is something that I work on because I love computer science and programming, and it's still in the alpha version. Chrome extension source can be found here and everyone is more than welcome to work on it. I'm not a JS programmer so it goes without saying that extension is the pre-alpha version.

I hope that this project helps you in your everyday life. It sure does to me. New features will come as the time goes by :).

Copyright © 2020 Marijan Šuflaj