The 579th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
Welcome to the latest issue of ProcessWire Weekly! In this week's issue we're going to check out the latest core updates (ProcessWire 3.0.249), as well as introduce a very interesting new project aiming to make headless ProcessWire projects simple and streamlined to set up: the ProcessWire JSON API.
As always we've also got a new site of the week to check out. This week that site belongs to Mental Health Space, which is a Munich, Germany based private mental health clinic managed by Dr. Ivana Ivandić. More details in just a bit, so keep on reading.
Thanks to all of our readers for being here with us again, and as always, any feedback is most welcome – please don't hesitate to drop us a line if there's anything in your mind you'd like to share with us. Enjoy our latest issue and have a great weekend!
Latest core updates: ProcessWire 3.0.249
This week we've got a new ProcessWire version, 3.0.249, in the dev branch at GitHub. As Ryan explains in his latest weekly update at the support forum, this version is some 20 commits or so ahead of the last tagged version, and among other things includes some updates for Admin Theme Uikit default theme.
One potentially interesting new feature that was added just this week is a new new()
method for the PagesType core class, used by $users, $roles, and $permissions API variables behind the scenes. Additionally the $pages->newPage()
method now also accepts a template ID in addition to a Template object.
In other news, Ryan also has a quick update to share regarding the processwire.com website redesign. The gist of it is that we're currently in the final stretch, and it looks like the new site might be released as soon as the end of this month — we're let you folks know as soon as we know more.
That's all for our core updates section this week. For more details, be sure to also check out the weekly update from Ryan at the processwire.com support forum. Thanks!
Introducing ProcessWire JSON API
This week we're going to take a quick sneak peek at a brand-new third party project, although still very much in development, is looking very promising: ProcessWire JSON API. Created by Ville "Fokke" Saarivaara, this PHP library — not a module, mind you — provides an easy way to set up a full-featured JSON API for a ProcessWire site.
While there are many ways to achieve this type of thing, here are some highlights for ProcessWire JSON API in particular:
- It is easy to get started with. Technically all you need to have a functioning API endpoint is to install the project, create a class for your first API endpoint, and instantiate the API in your site's init.php or ready.php file.
- It was built to scale with your needs, supporting multiple API instances, multiple service stacks, and service-wide request hooks.
- It has built-in support for things commonly needed when working with headless ProcessWire sites, such as the Page Parser for converting ProcessWire pages into structured data that is ready to use in API responses.
- It is based on some of the latest and greatest features of ProcessWire and PHP: under the hood ProcessWire JSON API makes use of URL hooks, a relatively new addition to the core, and utilizes many modern PHP best practices and features, including strong typing, enums, traits, and generators.
- It comes with a test suite. If you've been working on ProcessWire projects for a while, you'll likely be aware how rare that actually is.
Getting started with ProcessWire JSON API is covered in more detail in the docs, but here's what it could look like. First we'll need to implement a service, which is essentially a collection of API endpoints for your project — in this case we're implementing just a simple example service with a single API endpoint:
<?php namespace ProcessWire;
// /site/services/HelloWorldService.php
use PwJsonApi\{Service, Response};
class HelloWorldService extends Service {
public function __construct() {
parent::__construct();
$this
->addEndpoint('/hello-world')
->get(function () {
return new Response([
'hello' => 'world',
]);
});
}
}
Once the service has been defined, you can instantiate the API in e.g. /site/ready.php:
<?php namespace ProcessWire;
// /site/ready.php
require_once './services/HelloWorldService.php';
$api = new PwJsonApi\Api();
$api->setBasePath('/api');
$api->addService(new HelloWorldService());
$api->run();
Now that you've set everything up, sending a GET request to your your site with a path /api/hello-world/ — or simply opening it in the browser — should result in a JSON response. If this is the case, you've just successfully configured your first JSON API endpoint. For more details, you should refer to the project's guide section at GitHub.
At the moment ProcessWire JSON API is a work in progress: there may be changes to the way it works, and it is definitely not considered production ready yet. That being said, we really wanted to provide an early glimpse into it, as it has a lot of promise.
If you'd like to give ProcessWire JSON API a try, you can clone or download it from the pw-json-api GitHub repository, or install it via Composer (composer require fokke/pw-json-api
).
Big thanks to Fokke for sharing this project with us!
Site of the week: Mental Health Space
Our latest site of the week belongs to Mental Health Space — the private practice of Dr. Ivana Ivandić, a Munich basd psychologist working with clients in English, Croatian, and German. Her services include personalized psychotherapy, counseling, and coaching for adults, adolescents, and couples.
I specialize in providing compassionate, solution-focused, evidence-based mental health support to expats, adults, couples, and adolescents. I offer personalized therapy and counseling to help you cope with stress, anxiety, burnout, relationship problems and other challenges.
— Dr. Ivana Ivandić, Mental Health Space
The Mental Health Space website features a straightforward, easy-to-use user interface, a friendly and calming visual style, and plenty of photography to liven things up a bit. All in all it's an enjoyable site to browse, even if not the flashiest one we've featured; a style that feels very much in place for a professional mental health practice. In terms of content there's quite a lot here as well, including key details about the clinic and their services, answers to frequently asked questions, contact details, and even a blog section.
This website was created by Nikolas Djuga, and some of the behind the scenes details we could dig up about this multi-lingual website include the front-end being powered by the Bootstrap front-end framework, and the use of the popular cookie consent management solution PrivacyWire. There's a lot of custom stuff here as well, and the analytics platform appears to be Matomo, but there's not much else we can say here.
Congratulations to Dr. Ivana Ivandić for her very nice new website, as well as the creator of the site for a job well done — this is yet another project that we're quite happy to have featured in the ProcessWire sites directory!
Stay tuned for our next issue
That's it for the 579th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 21st of June. As always, ProcessWire newsletter subscribers will get our updates a few days later.
Thanks for staying with us, once again. Hope you've had a great and productive week, and don't forget to check out the ProcessWire forums for more interesting topics. Until next week, happy hacking with ProcessWire!
Post a comment