Inspired by jQuery

We enjoy working with the jQuery javascript library because its syntax is simple and fun to use, and it lets you get a lot done without a lot of work. We've always wished that we could find a similar experience with a CMS platform. As a result, ProcessWire's API is inspired by jQuery and its style and syntax.

The goal behind the ProcessWire API is to provide the level of accessibility and control to your site's pages that jQuery provides to the DOM.

That being said, there are fundamental differences in the way that PHP and Javascript work, not to mention even greater fundamental differences between an SQL database and the DOM. As a result, ProcessWire's CMS API is merely inspired by jQuery and there are as many differences as similarities. But my hope is that if you like jQuery, you'll find ProcessWire's API familiar and easy to work with. Even if you haven't worked with jQuery, the API is designed to be easy and approachable, and its scope is smaller than that of jQuery's (easier to learn).

What’s similar to jQuery?

DOM / Site Map
You interact with your site's structure via ProcessWire's API in a manner similar to working with the DOM in jQuery. The hierarchy of your site can be thought of like a DOM hierarchy, where every node (page) has a parent and every node may have children, and so on. Likewise, every node (page) can have its own attributes (fields). Depending on the type of node (template) the attributes (fields) will be different.

For the most part, ProcessWire's CMS API attempts to use the same method naming conventions as jQuery. For example, you may use the find(), children(), siblings(), parent() and parents() methods on any page (aka node) and optionally supply a selector. Read More

ProcessWire takes the idea of attribute selectors from jQuery and lets you apply that methodology to getting and finding pages in your site based on values in their attributes (aka fields). These selectors are a simplified version of what you find in jQuery, but the intention, experience and results are the same. For the most part, the operators used in a selector are the same as the operators used in jQuery selectors. More about Selectors

Like in jQuery, you can chain method calls in ProcessWire if you want to (fluent interface).

Like in jQuery, most traversing methods return values that can themselves be traversed and compared. For instance, a call to $page->find(...) or $page->children(...) returns an array type that also has its own methods for find(), filter(), first(), has(), add(), filter() and so on.


  • Soma

    Soma 6 years ago 189

    This got me interested.

  • Grant

    Grant 5 years ago 129

    Thank you for reminding people it's called "fluent interface" :)

  • abc

    abc 3 years ago 42

    yes its amazing

  • Kai / Memelpower

    Kai / Memelpower 2 years ago 21

    We are just starting with ProcessWire and reading your introductions, docs etc. The advantages above are lovely. It would be great to have two main paragraphs about jquery-like-coding on the startpage, because it seems unique compared to other CMS out there and should be quite intuitive.

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.