Lyfe for Craft CMS

Installation

Requirements

  • Craft CMS 5.3 or later
  • Craft Commerce 5.0 or later
  • PHP 8.2 or later

Lyfe has no other dependencies and no build step. It talks to Twilio and to SMS gateways over plain HTTP, so there is no SDK to install either.

Lyfe needs Commerce to be installed and enabled. If Commerce is disabled or mid-upgrade, Lyfe stays installed but stops listening for order events until Commerce is back.

Installing

From the Plugin Store, or:

composer require justinholtweb/craft-lyfe
php craft plugin/install lyfe

Installing creates Lyfe's tables and nothing else. No workflow exists, and nothing is sent, until you create one and turn it on.

Editions

Both editions are paid. Lite is $99 and Pro is $179.

Lite is the whole engine. Pro adds the features that need standing infrastructure: something watching carts, scanning contacts on a timer, or talking to an SMS gateway.

LitePro
Order placed, paid, status changed, refunded, specific product purchased✓✓
Account created and manual triggers✓✓
All 28 conditions, in OR-of-AND groups✓✓
Multi-step workflows with a delay before each step✓✓
Send email, add and remove tags, order notes, run log notes, stop-if✓✓
Webhooks✓✓
Simulator, dry run, activity, message log and engine log✓✓
Console commands✓✓
The presets that use only Lite features✓✓
Abandoned cart tracking, the Cart abandoned trigger and cart restore links✓
Scheduled contact scans (win-backs, VIP tagging)✓
SMS, through Twilio or your own HTTP gateway✓
Discount code generation✓
Change order status, add to and remove from user groups✓
Unsubscribe the contact (as a workflow step)✓
Send windows, per-contact run limits and cooldowns✓
The Tag added to a contact trigger, so one workflow can start another✓
Cancelling a contact's pending runs of other workflows✓

On Lite, Pro triggers and actions are listed in the editor with "(Pro)" after their names but cannot be selected, and the Pro settings and workflow limits are visible but disabled.

Moving between editions

Buy Pro in the Plugin Store, or switch the edition under Settings → Plugins.

A downgrade does not leave Pro workflows half-working. A workflow counts as Pro if its trigger is Pro, any of its steps is a Pro action, or it has a run limit, cooldown or send window set. On Lite, such a workflow can be saved only while it's paused, any one that's still enabled refuses to start, and the reason is written to the Lyfe log. It does not run with its Pro steps quietly skipped. A run that was already in progress when you downgraded records any Pro step it reaches as skipped, with "needs the Pro edition" as the reason.

Scheduling

Lyfe needs something to call it on a schedule. Delays, retries, abandoned-cart detection and scheduled contact scans all depend on it. Add one cron entry:

* * * * * /path/to/project/craft lyfe/run/due

That one command advances every step that has come due, then (on Pro) sweeps for abandoned carts and runs any scheduled contact scans that are due. The settings screen shows the exact line for your install, with the project path filled in.

If you cannot run cron, turn on Also process during web requests in Lyfe's settings. Lyfe then pushes a queue job at most once every Interval between web ticks (300 seconds by default). It never does the work inside the request itself, but it does rely on Craft's queue running, either automatically through web requests or through a queue worker. Cron is the more reliable choice.

To keep history from growing forever, schedule the prune command as well. It deletes finished runs, messages and log entries older than Keep history for (365 days by default):

0 3 * * * /path/to/project/craft lyfe/run/prune

Your first workflow

The quickest start is the library of 14 presets. Every preset installs disabled, with placeholder copy marked EDIT ME, so adding one never emails anybody.

  1. Go to Lyfe → Workflows and click Add from the library.
  2. Pick a preset, for example Post-purchase thank you, and click Add. Presets marked Pro are locked on Lite.
  3. Lyfe opens the new workflow in the editor. Rewrite every EDIT ME in the subject and body.
  4. Check the Safety section. Leave Enabled off for now and turn on Dry run if you want to watch real traffic without sending anything.
  5. Save, then choose Test against an order from the menu next to Save. This opens the simulator limited to this workflow. Enter a real order ID and click Simulate. It shows, rule by rule, whether the workflow would run for that order and what each step would do.
  6. When the simulator agrees with you, turn on Enabled and save.

Before you rely on Lyfe for marketing email, two checks are worth doing:

  • Send yourself a message with Test email in Lyfe's settings. It goes through Craft's own mailer with your from-address and layout template.
  • If you have existing customers, build their contacts from your order history with php craft lyfe/contacts/backfill. Without it, Lyfe only knows about customers whose orders, carts or registrations it has handled since it was installed. See Contacts.

The presets you can install from the console are listed in Usage.