Generates .phpstorm.meta.php for ProcessWire API autocompletion in PhpStorm.
| Setting | Type | Default | Description |
|---|---|---|---|
metaFilePath |
string |
site/assets/.phpstorm.meta.php |
Path relative to PW root |
generatePageClassFieldMeta |
bool |
false |
Field-type autocompletion per Page class |
generateDebounceSeconds |
int |
2 |
Min seconds between regenerations |
Run via php index.php --at-eval 'CODE'.
php index.php --at-eval '
$m = wire("modules")->get("ProcessWirePhpStormMeta");
$f = wire("config")->paths->root . $m->get("metaFilePath");
echo json_encode([
"exists" => file_exists($f),
"path" => $f,
"modified" => is_file($f) ? date("Y-m-d H:i:s", filemtime($f)) : null,
"config" => [
"pageClassFieldMeta" => (bool) $m->get("generatePageClassFieldMeta"),
"debounce" => (int) $m->get("generateDebounceSeconds"),
],
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
'php index.php --at-eval 'wire("modules")->get("ProcessWirePhpStormMeta")->generateMetaFile();'# All saved values
php index.php --at-eval '
echo json_encode(
wire("modules")->getConfig("ProcessWirePhpStormMeta"),
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
);
'
# Single value
php index.php --at-eval 'echo wire("modules")->get("ProcessWirePhpStormMeta")->get("metaFilePath");'php index.php --at-eval '
wire("modules")->saveConfig("ProcessWirePhpStormMeta", [
"generatePageClassFieldMeta" => true,
]);
wire("modules")->get("ProcessWirePhpStormMeta")->generateMetaFile();
'Injects custom PHP into the PHPSTORM_META {} namespace block. Multiple hooks concatenate.
$wire->addHookAfter("ProcessWirePhpStormMeta::generateCustomMetaContent", function($event) {
$names = [];
foreach (glob(wire()->config->paths->templates . "blocks/*.php") ?: [] as $f) {
$names[] = pathinfo($f, PATHINFO_FILENAME);
}
sort($names);
if (empty($names)) return;
$custom = "\n registerArgumentsSet(\"block_names\",\n";
foreach ($names as $n) $custom .= " \"{$n}\",\n";
$custom .= " );\n\n";
$custom .= " expectedArguments(\\ProcessWire\\renderBlock(), 0, argumentsSet(\"block_names\"));\n";
$event->return .= $custom;
});- Field saved/deleted · Template saved/deleted · Module installed/uninstalled
- "Regenerate Meta File" button in module settings
autoload = template=admin— only loads in admin.- Generated file is safe to commit (but overwritten on each regeneration).
- For richer per-page property stubs, combine with AutoTemplateStubs.