Jump to content

Is PW a framework?


franci77
 Share

Recommended Posts

Hi,

I have a question about PW. For developing totally custom applications/extensions, maybe parse some data from other site or whatever, you should need to build new module. I reckon modules are extensions to PW.

It is said that PW is CMF (Content management framework), that shows when you use it's API. But is it also any kind of framework for PHP, that comes in handy, when developing custom applications? Such as is Codeigniter or CakePHP? Or must be code written in pure PHP?

Thanks.

Best regards,

Franci

  • Like 1
Link to comment
Share on other sites

The beauty of ProcessWire is that it approaches content management without any assumption about what kind of content you're storing, or what you're going to do with it.  Content is data, and data is content, and are accessible equally through the API and the GUI.

You don't need to build modules to take full advantage of PW, or even make templates -- you can just include PW in any PHP script and have full access to its API.

So yes, it would be extremely easy to build a custom web application on PW.  You can just think of it as a way to interface easily and safely with MySQL.  It also happens to have a wonderful GUI backend, objects for santizing user input, and managing sessions.

  • Like 4
Link to comment
Share on other sites

Technically CodeIgniter and CakePHP are also "pure PHP" and a framework simply gives you a way to get a headstart on development using pre-defined classes etc.

I think what you're really asking is if you can use it as a framework and just access its classes directly as with those framework and the answer is definitely yes, but there is no single correct way to work with it which is the beauty of it :)

In ProcessWire, to use it as a framework you would bootstrap it and use the API to get stuff done. Here are some helpful links on that side of things:

http://processwire.com/api/include/ - The first few lines show how simple it is to include and get started, then this one shows you the vast majority (maybe all?) of the API functions on one page: http://processwire.com/api/cheatsheet/

  • Like 3
Link to comment
Share on other sites

.. and one more take for the same subject, from slightly different angle: ProcessWire is both CMS and CMF in one package, ie. by installing ProcessWire CMF you also get "admin" which is essentially a CMS built on CMF provided by ProcessWire. The line can be a bit blurry at times :)

Anyway, admin uses API behind the scenes, so it's not really that different from any other application you might build with PW (expect for the fact that it's probably larger.) You'll most likely want to keep it available even if you build something similar yourself -- if not for any other reason, at least to give you a nice way to view and manage templates and fields without having to do everything via API (which is of course possible too!)

From my point of view there are two main ways to use ProcessWire as a platform for your applications:

  • Bootstrapping (like Pete explained above) enables you to use it's features from strictly outside PW, ie. you could build whole application yourself and then make PW store (and fetch, sort, sanitize etc.) your data.
  • You could also use more of the framework provided by PW by creating your application as a PW site, using template files for your application / view logic and so on.

You don't really have to build modules to use PW (as a framework or a CMS) but they're a handy way to package some feature you need often into one reusable tool you can pull out whenever there's need for it. They also enable you to tweak how PW works out-of-the-box; you can, for an example, add new methods to PW objects such as Pages, without hacking core code (which is unbelievably useful at times.)

Process modules (one type of modules you can create for ProcessWire) are a bit different in that they integrate directly with admin tools, providing new features there. These let you extend default admin features a lot and more often than not whatever control panel your custom application needs could also be built this way :)

Generally speaking there are many similarities between PW and various web application frameworks like CodeIgniter and CakePHP, but PW doesn't venture quite as deep in the "generic utility" category and also forces as few restraints on you as possible. It's more focused on handling content and data types than providing you tools for general tasks (strings and numbers, email, FTP, complicated image manipulation etc.) and doesn't force a strict application structure (MVC, MTV etc.) on you (unless you build one yourself, like I've done for my own projects.)

I hope this helps understand a bit what PW is, how it relates to other frameworks.. and whether it's the tool you're looking for :)

Extra tip: cheatsheet is good place to start digging in PW. Turn on the advanced mode and you'll get pretty good idea what PW can offer.

  • Like 2
Link to comment
Share on other sites

Greetings,

I have wondered about the same thing. Coming from a CodeIgniter background (and more recently Yii). I often make comparisons between ProcessWire and frameworks.

The way I see it -- ProcessWire is a framework like Yii, but with several CMS elements added on to make common development tasks faster and easier. Beyond the crucial CMS elements, it's up to you how you actually want the system to behave and look. The syntax for querying the database and creating views is very "expressive" (as they like to say in the Laravel community), and the depth and combinations of your queries is wide open.

ProcessWire is really amazing. With that said, I do see some elements in CodeIgniter (and Yii) that could be adopted by ProcessWire.

I raised similar questions here: http://processwire.com/talk/topic/2393-processwire-framework/

Thanks,

Matthew

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...