• Restructuring Datastore Events in PHPNomad

    We’re moving datastore events out of the database layer and into the datastore layer while also splitting operation traits into paired versions (with and without events) to give developers more control over event emission. This change breaks backward compatibility but creates a more flexible, truly nomadic system where developers can choose exactly which operations should emit events rather than being forced into a one-size-fits-all approach.

  • Remove Concrete Container Solution and Create Integrations With DI Libraries

    I have come to realize it’s likely time to pivot away from PHPNomad’s simple container system, and embrace integrating with existing solutions, instead.

  • Feature Request: Make it possible to provide a class instance to binding transformers

    Currently, event bindings are supported using a callback. Ready::class => [ [‘action’ => ‘init’, ‘transformer’ => function () { $ready = null; if (!self::$initRan) { $ready = new Ready(); self::$initRan = true; } return $ready; }] ], This tends to be overly terse, and require calls like this in cases where you want to encapsulate the logic: $saleTransformerCallback = fn($orderId, $orderData) => $this->container->get( SaleTriggeredTransformer::class )->getSaleTriggeredEvent($orderId, $orderData); SaleTriggered::class => [ [‘action’ => ‘action’, ‘transformer’ => $saleTransformerCallback], ], It would be much nicer if it were possible to do this, instead: SaleTriggered::class => [ [‘action’ => ‘action’, ‘transformer’ => SaleTriggeredTransformer::class], ], Would…

  • Archive The Mutator Package

    Why We’re Saying Goodbye to Mutators The Mutator package, while well-intentioned, has become a source of unnecessary complexity in our development workflow. What started as an attempt to create a flexible data transformation system has instead created a maze of interfaces, adapters, and callbacks that obscure the true intent of our code. The Problem with Mutators Our current Mutator pattern introduces: A Better Path: Event-Driven Mutations Instead of wrestling with complex Mutator interfaces, we’re embracing a more intuitive approach: Simple, Direct Event Transformations class UserRegisteredEvent implements Event { private string $email; private string $name; public function setEmail(string $email): self {…

  • Pitch: Remove Core Package Completely

    The heart of the nomadic approach is that your code should be free to travel and adapt, like a digital nomad who can work from anywhere. The existence of a core package actually contradicts this fundamental principle. Here’s why: The solution is to break down the core package into focused, independent tools that developers can use as needed. Each piece should solve a specific problem in making code more portable, without creating dependencies on PHPNomad itself. Think of PHPNomad more like a travel guide than a destination. It should show you how to write code that can travel well, not…

  • Alex Standiford

    Ripped off a bandaid today. Finally got around to properly tagging all PHPNomad packages, and setting all of them up in Packagist. Currently at 40 repositories, so I needed to get ahead of this before it got out of hand.

  • Proposed New Facade Pattern That Supports Multiple Containers

    Current Implementation PHPNomad currently uses a Facade pattern implemented through abstract classes to provide static access to services. Facades serve two primary purposes: The current implementation requires: Challenges Architectural Limitations Impact on PHPNomad’s Core Philosophy The current Facade implementation conflicts with PHPNomad’s goal of writing truly portable code. By relying on global state and single container context, we limit the ability for code to be truly “nomadic” and run anywhere. Proposed Solution New Facade Pattern Instead of using abstract classes and global state, we propose a new pattern that: Implementation Details class LoggerFacade { use WithFacadeCapability; protected static function getRequiredType():…

  • PHPNomad As An MVC Framework

    PHPNomad As An MVC Framework

    So PHPNomad can run as an MVC framework now. That’s neat. I needed a way to make Siren run outside of WordPress. After careful consideration, I decided the best route to take was to set up the last couple of packages needed to just make PHPNomad capable of running as its own MVC framework. I spent a weekend creating the strategies that WordPress handles for Siren using various Symfony packages and other dependencies. After that, I structured it so that the app runs PHPNomad, registers the routes embedded in the application properly, and allows you to create views specific to…

  • Alex Standiford

    Spent time writing docs for PHPNomad yesterday, and the fruits of that labor came through already, when I was able to link to the docs a few times to help a developer with a PR.

    I always think about docs last, but then find myself wishing I had it months ago at the same time.

  • Alex Standiford

    One of my favorite things about working with PHPNomad’s strategy-based approach has been that if I want to use a different thing to implement that strategy (eg: Guzzle instead of wp_rest_*), ChatGPT can usually slap together a workable implementation of the interface quickly.

    Then I just swap them out in the app, and everything just works.

Alex
Alex
@alex@www.alexstandiford.com

Founder of Novatorius & creator of Siren Affiliates. WordPress engineer and partnership advocate helping businesses grow with flexible incentive programs.

4,916 posts
60 followers