Skip to content

About

IDE autocomplete generator

Resources

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

FFI IDE Helper Generator

PHP 8.1+ Latest Stable Version Latest Unstable Version Total Downloads License MIT

Requirements

Installation

Library is available as Сomposer repository and can be installed using the following command in the root of your project as a dev-dependency.

$ composer require ffi/ide-helper-generator --dev

Usage

Generate Metadata

Before generating the helper, the headers must be parsed to build the metadata data. To do this, castxml will be used, which in turn uses the original compiler (like clang) to build the AST.

use FFI\Generator\Printer\PhpStormMetadataPrinter;
use FFI\Generator\CodeGenerator;

echo new CodeGenerator()
    ->parse(__DIR__ . '/example-header.h')
    ->generate(new PhpStormMetadataPrinter())
    ->save(__DIR__ . '/resources/.phpstorm.meta.php');

Analyze Metadata

After the metadata is generated, it should be parsed and an abstract syntax tree built in memory.

use FFI\Generator\CodeGenerator;

$result = new CodeGenerator()
    ->parse(__DIR__ . '/example-header.h');

foreach ($result->nodes as $namespace) {
    var_dump($namespace);
}

About

IDE autocomplete generator

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages