processwire-custom-page-classes

Implement custom page classes in ProcessWire with PHPDoc and inheritance.

1|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/webmanufaktur/pwaiworkflow --skill processwire-custom-page-classes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: processwire-custom-page-classes
Source: https://github.com/webmanufaktur/pwaiworkflow/tree/main/.agents/skills/processwire/custom-page-classes
Command: npx skills add https://github.com/webmanufaktur/pwaiworkflow --skill processwire-custom-page-classes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on creating and utilizing custom page classes in ProcessWire, enabling developers to build more robust, maintainable, and IDE-friendly websites.

Core Features & Use Cases

  • Custom Methods & Properties: Extend page functionality with your own logic.
  • IDE Integration: Leverage PHPDoc for autocompletion and type hinting.
  • Inheritance & Interfaces: Structure your code effectively and enforce contracts.
  • Use Case: You need to add a method to all your blog post pages to automatically calculate related posts based on categories. This Skill shows you how to define a BlogPostPage class and add that method, making it accessible directly from your page objects.

Quick Start

Use the processwire-custom-page-classes skill to enable custom page classes in ProcessWire by adding $config->usePageClasses = true; to your /site/config.php file.

Frequently Asked Questions about processwire-custom-page-classes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable custom page classes in ProcessWire?

To enable custom page classes in ProcessWire, add `$config->usePageClasses = true;` to your `/site/config.php` file. This configuration activates the framework's object-oriented page extension mechanism for your templates.

How do I add custom methods and properties to ProcessWire pages?

Adding custom methods and properties to ProcessWire pages involves defining a dedicated class for your template and extending the base page logic. This approach encapsulates your data operations directly within the page object for better maintainability.

Can I get IDE autocompletion for ProcessWire custom page classes?

Yes, you can achieve IDE autocompletion for ProcessWire custom page classes by utilizing PHPDoc integration. Adding type hints and docblocks to your custom classes allows your IDE to recognize page properties and methods.

Does ProcessWire support inheritance and interfaces for custom page classes?

ProcessWire supports inheritance and PHP interfaces for custom page classes, allowing you to structure code effectively and enforce contracts. You can extend base classes like RepeaterPage and FieldsetPage to build hierarchical object models.

What are common pitfalls when developing object-oriented ProcessWire sites?

Common pitfalls when developing object-oriented ProcessWire sites involve mismanaging hookable methods, incorrectly structuring helper classes, and errors in output formatting. Understanding these potential issues ensures robust custom class implementation.

What is the best way to structure related post logic in ProcessWire?

The best way to structure related post logic in ProcessWire is by creating a specific class, such as `BlogPostPage`, to encapsulate the calculation. This object-oriented approach attaches the logic directly to the page object, keeping templates clean.