Jump to content



Recommended Posts

A serializer module for ProcessWire Pages. This module will add a new method to all pages, called serializer(), which returns JSON.


## Dependecies

  • symfony/serializer
  • symfony/property-access

## Requirements

  • ProcessWire 3.x
  • Composer

## Installation

cd site/modules
git clone git@github.com:Luis85/FlowtiPageSerializer.git
cd FlowtiPageSerializer
composer install

## Usage


will return the serialized Page Object as a JSON string representation containing all accessable fields calling


returns the Page Object with just this field

$page->serialize(['field1', 'field2'])

will return the choosen fields


This is my initial commit, just cobbled together a wrapper around the symfony/serializer component which i plan to use for data serialization and deserialization. 

The module can just serialize a given page and limit its output a field string or an array of strings. 

Supports only json output right now. 

Supports only 1 dimension of data, so no reference titles / .dot syntax.


Can someone please enlighten me how to setup a proper composer setup for PW Module Development btw? 

  • Like 5
Link to comment
Share on other sites

On 6/15/2021 at 4:02 PM, LuisM said:

Can someone please enlighten me how to setup a proper composer setup for PW Module Development btw? 

Could you explain what your goal is? I mean — you're already handling dependencies via Composer, so that's a good start at least ?

If you want the module itself to be installable via Composer, the approach I'd currently recommend is detailed here: https://github.com/wireframe-framework/processwire-composer-installer. Change the "type" in your composer.json to "pw-module" and add wireframe-framework/processwire-composer-installer to your requires and that's just about it.

In case you were wondering, ProcessWire doesn't currently have a way to handle Composer dependencies when a module is installed via Admin. Module with dependencies will either a) need to be installed the regular way and then the user has to run composer install manually, or b) installed via Composer (see processwire-composer-installer) in which case dependencies are automatically handled.

... or you could bundle all dependencies in the Git repository itself. Somewhat crude approach perhaps, but also the easiest one for most users of your module.

  • Like 3
Link to comment
Share on other sites

Thanks Teppo,

helped me already a lot. I think I should dive deep into your framework and have a look at your solutions/implementations ?

Bundling my dependcies into the repo is not an option ? 

What I want to achieve

  • proper dependency management on a Module base
  • dependency management of the whole project including modules
  • A proper way to build and publish modules / profiles for easy consumption

The third part would be the hardest part I guess. I started to work on a module, based on deployphp/deployer to somehow have the possibility to get a proper Build Pipeline from local -> dev -> staging -> prod

Another thing I did, was to integrate vlucas/phpdotenv to handle different Environments based on, you guessed it, the particular environment. 

But first things first, Dependency Management. 

I played around to split my codebase into git submodules, which will give me a new lot of problems to manage them in the long term, but it seems to be the way to go. 

The root cause for all of this, is my usage of ProcessWire as a backend for a multi-tenant system with a plethora of problems on its own, which I will write some stuff about in the future. 

And on a sidenote, I dream to composer require ProcessWire and just use it as a Frontend Service.

  • 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...