Inertia.js Adapter for Statamic

Packages

May 7th, 2021

intertia.js-for-statamic-featured-1620346505.png

Inertia-statamic by Adam Campbell is a Statamic server-side adapter for Intertia.js used to build single-page apps without building an API.

The Intertia.js adapter will work for Statamic pages or content available through Statamic collections. Once you follow the readme setup instructions, Statamic page objects will be available in given Vue components as props.

Here's a visualization of props given in the project's readme:

1Inertia\Response {#2587 ▼
2 #component: "Marketing/Overview"
3 #props: array:22 [▼
4 "amp_url" => null
5 "api_url" => null
6 "collection" => array:3 [▶]
7 "content" => array:4 [▶]
8 "date" => Illuminate\Support\Carbon @1617827556 {#2478 ▶}
9 "edit_url" => "http://mysite.test/cp/collections/marketing/entries/f854a1cf-0dcf-404b-8418-a74662ba77e7/overview"
10 "id" => "f854a1cf-0dcf-404b-8418-a74662ba77e7"
11 "is_entry" => true
12 "last_modified" => Illuminate\Support\Carbon @1617827556 {#2477 ▶}
13 "mount" => null
14 "order" => null
15 "parent" => null
16 "permalink" => "http://mysite.test/marketing"
17 "private" => false
18 "published" => true
19 "slug" => "overview"
20 "template" => "app"
21 "title" => "Overview"
22 "updated_at" => Illuminate\Support\Carbon @1617827556 {#2523 ▶}
23 "updated_by" => array:4 [▶]
24 "uri" => "/marketing"
25 "url" => "/marketing"
26 ]
27 #rootView: "app"
28 #version: ""
29 #viewData: []

You can learn more about this package, get full installation instructions, and view the source code on GitHub. Since this package uses Statamic and Intertia.js, check out the Inertia.js documentation and the Statamic 3 Docs.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.