Joan for Craft CMS

Free · Craft CMS 5

Find out what nothing is using

Every Craft site of any age accumulates content model it no longer needs — a field made for a section that got redesigned, a Matrix block type nobody has picked in three years, six entry types left behind by a plugin that was uninstalled. None of it does much harm, and none of it can be safely removed, because nobody can prove it isn't used. Joan proves it.

Joan

A verdict, not a number

Craft's field settings screen lists the field layouts a field appears in, which is a useful third of the answer. It doesn't know whether a single element has ever had a value in that field, and it doesn't look at your templates. Joan answers the whole question, and says which of six things is true.

text
In use           In a layout, and elements hold values for it.
Never filled in  In a layout, and not one element has ever been given a value.
Stranded         In no layout — but content rows still carry values.
Code only        No layout, no content, but the codebase still names the handle.
Unused           No layout, no content, named nowhere. Nothing would miss it.
Not counted      Stored somewhere Joan can't measure — reported as unknown, never as zero.

Features

Three passes over the database and one over your codebase, and then it stands out of the way.

Counts what's actually in each field

Not "is it in a layout" — how many elements hold a non-empty value, broken down by element type and by site.

  • Drafts and revisions excluded by default, because fifty revisions per entry would call every abandoned field busy
  • 0 and a switched-off lightswitch count: an editor made that choice
  • A Table field of empty cells does not: something was stored, nothing was entered

Reads your codebase

A field can be in no layout and hold no content and still be referenced — by a template that populates it on save, by a module, by a migration. Joan looks, and shows you the lines.

  • Every hit classified: entry.myField is worth more than the word in a comment
  • File, line number and the source line, so "safe to delete" means something
  • Every handle a field answers to, including the ones a field layout renamed

Three kinds of storage, counted three ways

Craft 5 keeps field values in three different places. Count one and miss the others and the report is worse than useless.

  • Most fields: elements_sites.content, keyed by the field layout element's UID
  • Relational fields also have rows in relations — both counted, the larger taken
  • Matrix and nesting CKEditor own entries of their own and store nothing in the content column

Attributes every field layout

Including the ones no element type claims — Hyper's link types are the usual example — and the ones nothing claims at all, which are usually left behind by an uninstalled plugin.

  • Craft says "1 unknown field layout" and leaves you there
  • Joan names the owner, or says plainly that nothing claims it

Covers entry types and Matrix

Craft 5 turned Matrix block types into entry types, so they share a screen: which sections use each one, which fields nest it, and how many entries exist.

  • And the question nothing else answers: which of the eight block types a Matrix field allows has anyone ever actually used

Finds content with nowhere to live

Craft 5 keys stored content by field layout element, not by field. Take a field out of a layout and its values stay behind under a key nothing will ever read again.

  • Joan finds those keys and counts the rows carrying them
  • Not a reason to delete faster — if the field was removed by accident, putting it back brings the content into reach

Joan in the control panel

Real screens from a Craft 5 install — the size of the content model, every field with its verdict, and the whole answer for one field.

Joan's Overview screen in the Craft control panel, counting fields, unused fields, never-filled-in fields, stranded content, entry types and field layouts, with the fields worth a look and the fields holding the most content
Joan's Fields screen listing every custom field with its type, layout count, element count, code references and verdict, filterable by verdict and field type
A single field's page in Joan, showing its verdict, the field layouts it appears in and the handle it answers to in each, element counts by type and site, and the template lines that reference its handle
Joan's Cleanup screen grouping fields nothing uses and fields nobody fills in, each with its layout, element and code counts

Screenshots from a live install, not mockups.

And from the command line

Everything the control panel shows, plus an exit code you can put in a build. Start with --fail-on=stranded on an existing site; unused is the stricter gate and is more useful once the first run's backlog is cleared.

bash
php craft joan/fields                      # the inventory
php craft joan/fields --verdict=unused     # just the abandoned ones
php craft joan/fields/show heroImage       # everything about one field
php craft joan/entry-types/nested          # what's actually inside each Matrix field
php craft joan/export fields --format=json --path=storage/joan.json

php craft joan/unused --fail-on=stranded   # fail the build on content with nowhere to live
php craft joan/unused --fail-on=unused     # …or on anything nothing references at all

Frequently Asked Questions

The questions worth answering before you install it.

Take stock

One composer require, one page load, and you will know how much of your content model nothing is using. It's free, and it can't break anything.