davidrjenni/lsif-php

Language Server Indexing Format (LSIF) generator for PHP

v0.0.5 2022-04-24 17:00 UTC

This package is auto-updated.

Last update: 2022-04-24 17:03:17 UTC


README

CI Coverage License: MIT Packagist Version PHP Version Docker Image Version Docker Image Size

Language Server Indexing Format (LSIF) generator for PHP

This repository is indexed using itself and available on Sourcegraph.

Requirements

lsif-php needs the composer.json and composer.lock file of the project to index present in the current directory. It uses the autoload and autoload-dev properties to determine which directories to scan.

Usage

To use a self-hosted Sourcegraph instance, set the SRC_ENDPOINT and SRC_ACCESS_TOKEN environment variables.

GitHub Actions

Add the following job to your workflow:

on:
  - push

jobs:
  lsif-php:
    runs-on: ubuntu-latest
    container: davidrjenni/lsif-php:main
    steps:
      - uses: actions/checkout@v3
      - name: Generate LSIF data
        run: lsif-php
      - name: Apply container owner mismatch workaround
        run: |
          # FIXME: see https://github.com/actions/checkout/issues/760
          git config --global --add safe.directory ${GITHUB_WORKSPACE}
      - name: Upload LSIF data
        run: src lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}

GitLab

Add the following job to your pipeline:

lsif-job:
  image: davidrjenni/lsif-php:main
  artifacts:
    reports:
      lsif: dump.lsif
  scripts:
    - lsif-php
    - src lsif upload

Manual

Install lsif-php with composer and the src binary. Then generate the LSIF data and upload it:

$ composer require --dev davidrjenni/lsif-php
$ vendor/bin/lsif-php
$ src lsif upload