ProcessWire Weekly #360

In the 360th issue of ProcessWire Weekly we'll cover ProcessWire 3.0.175, the Module API Docs module from BitPoet, and more. Read on!

Welcome to the latest issue of ProcessWire Weekly. This week we're going to introduce ProcessWire 3.0.175 and the splendid database related features it comes with, and also check out a third party module called Module API Docs.

For our latest site of the week we found some really great sites, before deciding on the food blog of Alexandra Thomas. This site comes with a very nice blog layout, numerous features including a dynamic recipe tool and PDF exports. More about that in just a bit!

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.175

This week's blog post from Ryan is a very in-depth look into the latest major feature to land on the core, as well as the general subject of database scalability. We'll provide a brief sneak peek into both topics here, but be sure to visit the blog post for plenty of extra detail — as always.

Scaling the database: what does this mean, and why does it matter?

While most sites don't need to worry about database level scalability all that much, on popular sites the database can become a bottleneck. Up to a certain point you can just keep switching to bigger and more powerful database instances, but that approach comes with limitations and is not exactly cost-effective.

This brings us to read-only and read-write databases: read-only database instances are usually much cheaper and scale much further than their read-write counterpieces. Add that to the fact that most sites perform more read operations, and we start seeing light at the end of the tunnel: by dividing our queries into two categories and then sending them to separate DB instances we get major benefits in terms of scalability and costs.

For this to work, we obviously need two things to be true: the system powering the site (in this case ProcessWire) needs to be able to handle multiple database connections and divide queries by their nature, and the host needs to support separate read-only database instances. Both requirements can now be met under right circumstances.

Database related improvements in ProcessWire 3.0.175

ProcessWire 3.0.175 adds support for read-only database connections. These can be configured via the $config->dbReader setting:

$config->dbReader = [
    'host' => 'read-only-database-host',
];

By default all the options you don't override in the dbReader setting use the values of the primary database connection ($config->dbUser, $config->dbPass, etc.) ProcessWire can automatically identify read requests and pass them to the read-only connection, but in some cases you may want to help it by only defining the default connection:

if (!$config->requestPath('/processwire/')) {
    $config->dbReader = [ 'host' => 'read-only-database-host' ];
}

What we're doing here is defining the read-only instance only if we're not in the admin, since in that context many queries are likely to be write ones, and there's also less of a benefit in separating queries by type. Ryan currently recommends this tweak, though it is unclear how much of a benefit there is to it.

One more thing to add is that ProcessWire now only initiates a database connection on demand, which could be a nice thing in itself.

For more details, be sure to check out the weekly blog post. Thanks!

New module: Module API Docs

Module API Docs is a new module by BitPoet. As he explains in the support forum, this module was born out of the realization that there's often a lot of jumping between API docs and module source code. The goal here is to combine both in one module, which you can then use as a single source of truth for your site.

The module is quite fresh, so expect some bugs there. Behind the scenes it uses PHP-Parser together with a custom class that extracts the information I needed, and the core TextformatterMarkdownExtra module for rendering the description part in the phpdoc style comments.

— BitPoet

The module provides a general documentation page for all modules (installed as well as uninstalled ones), core classes, and template files. This page includes whatever can be extracted from the module's comments, as well as details about the properties and public (and optionally protected) methods it happens to have.

A little warning, though: this module is at an early state, so you may want to test it with care, and perhaps avoid installing it on a production site for now.

For more details be sure to check out the Module API Docs modules directory entry, as well as the Module API Docs support forum thread. You can install the module directly from the admin via the built-in module manager, or grab it from the GitHub repository.

Big thanks to BitPoet for sharing this project with us!

Site of the week: www.dothiscookingthing.de

Our latest site of the week is a cooking blog going by the name of Do this cooking thing. The blog is managed by Alexandra Thomas, while the development side was handled by Markus Thomas.

This site, which was recently introduced by Markus in a showcase forum thread, has a rather typical set of blog features, from a front page that lists recent posts to a single blog post view, a tag search feature, and some additional content pages. The design is pleasant and combined with mouth-watering pictures of food servings, it's a real treat to browse.

As Markus explains in the showcase post, one of the reasons this site was built was to learn more about ProcessWire. As such, it also has certain features that make it a bit more than just a static site:

  • JSON-LD metadata for the recipes and page search
  • Automatic ingredient calculation when the number of servings is updated
  • Automatic creation of a PDF document of an individual recipe
  • PWA support, making it possible to install this site locally

The front-end of this site is powered by the Uikit front-end framework and laid out with CSS grid. As for third party modules, the ones mentioned in the showcase post include commercial Pro modules ProMailer and Repeater Matrix, as well as some popular third party tools, such as Pages2PDF and AIOM.

For more details, be sure to check out the showcase forum thread. Big thanks to Markus for sharing this project with us, and of course to Alexandra for posting her recipes on the blog — we truly enjoyed both the content and the site!

Stay tuned for our next issue

That's all for the 360th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 10th of April. 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