Spark has been replaced by the Datastar plugin and is no longer available.

Spark started out as a Craft plugin that built on top of the Datastar framework. As Ben became more involved in the project, to the point of becoming a core contributor, he developed an official PHP SDK that does much of the work that Spark did. 

Since the Craft plugin became a very thin layer, we figured we might as well call it what it is. The Datastar plugin is that thin layer, which stays as true to the framework’s API and ethos as possible. 

Migrating to Datastar #

First uninstall Spark and install the Datastar plugin.

Spark used Datastar version 0.19.9, so you’ll need to convert all signals, data attributes and actions to the version v1.0.0‑beta.1 syntax (see the release notes).

Regular Templates #

  • Action plugins now have a @ prefix. Replace all instances of $actionName() with @actionName().
  • Replace data-store with data-signals.
  • Replace data-bind with data-attr.
  • Replace data-model with data-bind.
  • Replace data-* attribute modifier delimiters . with __ and argument delimiters _ with . (data-on-keydown__debounce.100ms).
  • Replace {{ spark(template, variables, method) }} tags with {{ datastar.get(template, variables, options) }} and {{ datastar.post(template, variables, options) }} tags.
  • Remove {{ sparkUrl() }} tags and use {{ datastar.get(}) }} and {{ datastar.post(}) }} tags instead (no replacement exists).
  • Replace {{ sparkStore(store) }} tags with {{ signals|json_encode }}.
  • Remove {{ sparkStoreFromClass() }} tags (no replacement exists).

Spark Templates #

  • Ensure all fragments are wrapped in {% fragment %} tags.
  • Replace the store variable with signals.
  • Replace spark.runAction with datastar.runAction.
  • Replace {% do spark.remove(selector) %} tags with {% fragment remove selector %} tags.
  • Remove {% do spark.redirect() %} tags and use {% executescript %} tags to execute redirects using JavaScript.
  • Remove {% do spark.console() %} tags and use {% executescript %} tags to output console messages using JavaScript.

Have a suggestion to improve the docs? Create an issue with details, and we'll do our best to integrate your ideas.