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 --devBefore 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');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);
}