The 624th 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 what's new in the core this week, introducing ProcessWire 3.0.259 (dev) that, among other things, adds a whole new module type: CliModules, short for Command-Line Modules.
In other news we're going to check out the first available CliModule, WireTests, which is a test suite for ProcessWire created by Ryan himself. And, as always, we've also got a new site of the week to highlight; this week that site belongs to a boutique hotel at South Carolina, The Shelby Hotel in Myrtle Beach. Keep on reading for more details.
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.259
This week we have a new dev version of ProcessWire, 3.0.259, along with a new weekly update from Ryan at the support forum. This version comes with a major new feature addition: a new module type CliModule (Command Line Interface module).
Introducing ProcessWire CliModules
CliModules are essentially a native method of defining tasks that are executed via the command-line interface (CLI). While this has always been possible by defining a script that bootstraps ProcessWire, CliModules are a purpose-built tool that, thanks to their modular nature, can be easily shared, installed, copied from project to project, etc.
In practice CliModule is a new module type and interface that you can implement in your own modules. Each CliModule must specify a "cli" key in their module info; this essentially defines a namespace for the module. They should also provide a method executing commands, and another that tells the user which commands they expose:
class HelloWorldCli extends WireData implements Module, CliModule {
public static function getModuleInfo() {
return [
'title' => 'Hello World CLI module',
'description' => 'Just an example',
'version' => 1,
'cli' => 'hello',
];
}
public function executeCli(array $args) {
$command = $args[0] ?? '';
$name = isset($args[1]) ? $args[1] : 'friend';
if($command === 'hi') {
echo "Hello there $name!";
} else if($command === 'bye') {
echo "Goodbye $name, see you later!";
} else {
echo "Specify 'hi' or 'bye' optionally followed by a name";
}
}
public function getCliCommands() {
return [
'hi' => 'Say hello',
'bye' => 'Say goodbye',
];
}
}Once a CliModule is installed, you can access it via ProcessWire's index.php file:
php index.php helloWe'll take a closer look at one CliModule in just a bit — the all-new test suite Ryan has also released just this week. And we really look forward to seeing what you guys will create using this amazing new feature.
That's all for our core updates section this week. For more details, including latest news regarding the Agent Tools AI module for ProcessWire that Ryan has been working on, be sure to check out the weekly update from Ryan at the support forum. Thanks!
New module: Wire Tests
WireTests is a new, free, optional (non-core) module that Ryan has just published via the modules directory. This module is a test suite for ProcessWire — something we've had various requests for, and now it is here!
WireTests is a simple, runnable test suite for ProcessWire modules and core classes. Tests verify that modules work as intended and as documented — covering field creation, value storage/retrieval, output formatting, selectors, and more.
— Ryan
In its current state WireTests includes tests for Fieldtype modules in the core, but it is not tied to any specific fieldtype per se. As Ryan explains in the module's README, it is capable of testing different types of modules, as well as core classes.
WireTests is implemented as a CliModule; the new module type we covered earlier in this weekly issue. As such, it requires ProcessWire 3.0.259 or later, i.e. our current dev version. Here's an example of how you can access WireTests, once it's installed:
# Run a single test
php index.php test FieldtypeText
# Run all tests
php index.php test allWireTests is meant to be extendable, so you can add your own tests to it. The module's README (and the modules directory entry) provide details about included tests, as well as a guide for adding your own tests and the best practices you should be aware of. If you want to contribute to the module, pull requests are welcome!
Please note that WireTests creates a new template ("test") and a new page (/test/) on install, so make sure those don't collide with your existing templates. Also, you should be careful before installing this module on a live site, as it is technically early beta, requires a fresh development version of ProcessWire, etc.
If you'd like to give this module a try, you can clone or download it from the WireTests GitHub repository, or install it via the built-in modules manager in admin. Thanks to Ryan for creating this module and sharing it with us!
Site of the week: The Shelby Hotel in Myrtle Beach
Our latest site of the week belongs to The Shelby Hotel in Myrtle Beach, South Carolina. It is an oceanfront boutique hotel with retro-inspired vibe, located right on the beach, a short walk away from the Boardwalk, SkyWheel, and various restaurants, bars, and other attractions.
Nestled in the heart of Myrtle Beach, our boutique oceanfront hotel Myrtle Beach offers more than just a place to stay—it’s a destination that celebrates the local spirit and beauty of the coast
As far as hotel websites go, this one has just about everything you'd expect: plenty of information about the hotel, plenty of photos about the location and their various amenities, details about available rooms, and information for anyone interested in holding an event — such as a wedding — at their premises. The design of the site is modern and enjoyable, and it has a very easy to use, mobile friendly user interface.
As for some behind the scenes details, the front-end of this site is powered by the Uikit front-end framework, and one interesting front-end feature is the handy little accessibility widget, powered by Adally. When it comes to non-core ProcessWire modules, there is only one that we could spot in action on this site: the commercial, all-in-one caching and minification tool ProCache.
Our congratulations to The Shelby Hotel in Myrtle Beach for their new, ProcessWire powered website!
Stay tuned for our next issue
That's it for the 624th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 2nd of May. 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