Generates a .phpstorm.meta.php file for ProcessWire autocompletion in PhpStorm.
Features
- Autocomplete wire container keys for
wire('...')andWire::wire('...') - Autocomplete module names for
Modules::get()andModules::install() - Autocomplete field names for
Fields::get() - Autocomplete template names for
Templates::get() - Autocomplete unique page names for
Pages::get() - Autocomplete hookable methods for
Wire::addHook*() - Autocomplete page status constants/strings for
Page::status(),addStatus(),removeStatus(),hasStatus() - Autocomplete field flags for
Field::addFlag(),removeFlag(),hasFlag() - Autocomplete template cache-expire constants for
Template::cacheExpire() - Autocomplete Inputfield collapsed constants for
Inputfield::collapsed() - Autocomplete sort flags for
WireArray::sort()/sortFlags()/unique()andPageArray::sort()/sortFlags()/unique() - Optional: Field type autocompletion per Page class (when enabled in module config)
Installation
- Copy the module folder into
site/modules/ProcessWirePhpStormMeta/. - Install the module in the ProcessWire admin.
Usage
- Default path:
site/assets/.phpstorm.meta.php(configurable in module settings). - The file regenerates automatically when fields, templates, or modules change (debounced).
- You can manually regenerate from the module settings screen.
- Optional: enable "Generate page-class field metadata" in module settings for field type hints per Page class. This is intentionally basic. For richer field stubs, use AutoTemplateStubs.
Examples
Modules
$tracy = $modules->get('TracyDebugger');
// Autocomplete + correct class type for navigation and code insightWire Container
$page = wire('page');
$pages = $this->wire('pages');
$cache = wire('cache');
// Autocomplete for keys like page/pages/cache/etc.Fields
$body = $fields->get('body');
// Autocomplete field names, fewer typosTemplates
$tpl = $templates->get('basic-page');
// Autocomplete template namesPages
$home = $pages->get('/');
// Maps to the page class when page classes are enabledPage Status
$page->status(Page::statusHidden);
$page->addStatus('draft');
$page->removeStatus(Page::statusUnpublished);
$page->hasStatus('locked');Field Flags
$field->addFlag(Field::flagAutojoin);
$field->removeFlag(Field::flagAccess);
$field->hasFlag(Field::flagGlobal);Template Cache Expire
$template->cacheExpire(Template::cacheExpireParents);Inputfield Collapsed
$inputfield->collapsed(Inputfield::collapsedYesAjax);Sort Flags
$items->sort('title', SORT_NATURAL | SORT_FLAG_CASE);
$items->sortFlags(SORT_NATURAL);
$items->unique(SORT_STRING);Page-Class Field Metadata (Optional)
$home = $pages->get('/');
// $home is HomePage (page class)
// Field types are inferred from the template fieldgroup
// e.g. $home->hero_image -> Pageimage or Pageimages depending on field settingsHooks
$wire->addHookAfter('Pages::save', function($event) {
// Autocomplete hookable methods while typing the hook string
});Notes
- Hook scanning reads ProcessWire core, modules, and admin templates to build the hook list.
- If page classes are enabled, page names map to their page class; otherwise they map to
Page. - Improvement suggestions and PRs are welcome.
License
Mozilla Public License 2.0. See LICENSE.
More modules by interrobang
Textformatter Make HTML Links
This Textformatter will create HTML links out of anything that resembles a URL or email address, as long as it is not already part of an tag.17TextformatterMakeLinks by interrobang- Added 3 days ago by interrobang
Install and use modules at your own risk. Always have a site and database backup before installing new modules.