Repository navigation
API Snap Cards
Caligrafy Quill 2.26.0. Generated from the source by
php qa/build-api-reference.php; the guides explain how to use these classes, this reference says exactly what each public method takes and returns. Back to the API reference.
Part of Snap.
namespace Caligrafy\Snap;
class CardsSource: framework/core/Snap/Cards.php:22
Snap Cards (2.23.0): every card is built from what a capability already declares
Families and types (marketing names the family with the type):
Ask: Form, Choice, Confirm Show: Answer, List Go: Shortcut Track: Task Offer: Suggestion, Routine
Phase 1 builds Ask: Form, Ask: Choice, Show: Answer and Show: List from:
- the capability's rules and descriptions (fields, types, limits, choices, required)
- the shape of its result (a page, a list, a record, a value)
- optional hints in application/config/snap.php (Snap\Hints)
The model, later, only picks a card and fills it; it never invents a card's structure.
VERSION = 1MAX_OPTIONS = 50THING_ICONS = ...VERB_ICONS = ...FIELD_ICONS = ...MAX_COLUMNS = 5LONG_TEXT = 140HIDDEN = '/^(snap_|notify_|queue_work$)/'
-
public static $path = '/snap': string where Route::snap() serves the cards ('/snap' by default)
Cards::ask()Cards::show()Cards::confirm()Cards::forget()Cards::needsInput()Cards::notice()Cards::catalog()Cards::fields()Cards::url()Cards::applies()Cards::name()Cards::risk()Cards::icon()Cards::title()Cards::plural()Cards::singular()
public static function ask(
$name,
Context $context,
array $values = array(),
array $errors = array(),
$message = null,
$asForm = false
)The card that asks for a capability's inputs: Ask: Form, or Ask: Choice when one pick is all that is missing
Parameters
$name-
$contextContext -
$valuesarray, defaultarray(): inputs already known (prefilled) -
$errorsarray, defaultarray(): field => message, from a refused call -
$message, defaultnull -
$asForm, defaultfalse
Source: framework/core/Snap/Cards.php:47
public static function show($name, $result, array $input, Context $context)The card that shows a capability's result: Show: List for many rows, Show: Answer for one record or a value
Parameters
$name$result-
$inputarray -
$contextContext
Source: framework/core/Snap/Cards.php:96
public static function confirm(
$name,
Context $context,
array $inputs,
$token,
array $changes,
$subject,
$risk,
$undoable,
$message = null
)Ask: Confirm: what a change will do, before it runs (phase 2). The token is the person's consent once they click; the card's address never carries it.
Parameters
$name-
$contextContext -
$inputsarray $token-
$changesarray: [label, before?, after] lines $subject$risk$undoable-
$message, defaultnull
Source: framework/core/Snap/Cards.php:155
public static function forget()Forgets the choices read in this request (after a change, so the next card shows what is true now)
Source: framework/core/Snap/Cards.php:192
public static function needsInput(array $ask, array $inputs)Whether an Ask card still needs the person: a required input is missing, or only the id of a thing to change was given (an update_ starts as its form). A delete needs nothing more than its id.
Parameters
-
$askarray -
$inputsarray
Source: framework/core/Snap/Cards.php:202
public static function notice($name, $message, $kind = 'info', array $inputs = array())A message instead of a result: a refusal that is not about the inputs (not found, conflict, forbidden)
Parameters
$name$message-
$kind, default'info' -
$inputsarray, defaultarray()
Source: framework/core/Snap/Cards.php:220
public static function catalog(Context $context, $run = true)Every capability this person may use, as the card it starts with (the gallery of phase 1)
Parameters
-
$contextContext -
$run, defaulttrue
Source: framework/core/Snap/Cards.php:234
public static function fields($name, Context $context, array $values = array(), ?array $hints = null)The fields of an Ask card, from the rules: widget, limits, options, label, help, current value
Parameters
$name-
$contextContext -
$valuesarray, defaultarray() -
$hints?array, defaultnull
Source: framework/core/Snap/Cards.php:259
public static function url($name, array $input = array())No doc comment.
Parameters
$name-
$inputarray, defaultarray()
Source: framework/core/Snap/Cards.php:335
public static function applies($name, array $record, Context $context)Whether an action applies to a record now, from its hint 'applies':
'in' => array('capability' => 'list_loans', 'field' => 'book_id') the record is in that list
'not_in' => array(...) the record is not in that list
The list is read as the person (once per request); one they may not read leaves the action out.
Parameters
$name-
$recordarray -
$contextContext
Source: framework/core/Snap/Cards.php:572
public static function name(array $record)What a record is called: its own title or name, else the title or name of the record it is about (a loan is about its book), else its username, else #id
Parameters
-
$recordarray
Source: framework/core/Snap/Cards.php:600
public static function risk($capability)No doc comment.
Parameters
$capability
Source: framework/core/Snap/Cards.php:620
public static function icon($name)No doc comment.
Parameters
$name
Source: framework/core/Snap/Cards.php:633
public static function title($name)No doc comment.
Parameters
$name
Source: framework/core/Snap/Cards.php:646
public static function plural($word)No doc comment.
Parameters
$word
Source: framework/core/Snap/Cards.php:699
public static function singular($word)No doc comment.
Parameters
$word
Caligrafy: Describe it. Approve it. Ship it. Your idea turned into a complete app: every feature built once, for web pages, Vue apps, a REST API and AI agents, and online.
Why Caligrafy: the benefits, the measurements, and what it is not yet
-
Quickstart with Claude: describe it, approve it, ship it
or the Quickstart: the same three steps by hand, in 5 minutes
- How Caligrafy works: the ideas in 5 minutes
- Your first capability: build a feature, page included
-
Capabilities in depth
-
#[Capability]: every option - Scheduled jobs: capabilities on a timer
- Notifications: web push and email
- Background jobs: capabilities run later
- Migrations: database changes, in order
- The cache
-
Testing your app
- Dependency injection
- Validation rules
-
Web pages
- Views and page components
- Design styles: another look, one setting
- Declarative routes: every request, in one line
-
Route::page·Route::form·Route::auth·Route::webhook·Route::download·Route::redirect·Route::action·Route::snap· capability routes - How to export a list as CSV
- Controllers: moving one to a declared route · how to, step by step
- Forms and helpers
-
Vue apps
-
Mobile and tablet
-
REST API
-
AI agents
-
Snap Cards and the assistant
- Payments: Stripe and crypto
- Face detection and face login
- OpenAI: chat and images · Assistants
- Open models: Llama, Mistral...
- Chatbots with Watson
- Machine learning in the browser
- Metadata and social cards · search and analytics
-
Putting it online: the production image, the database at every start
-
API reference: every class and method
-
Routing ·
Route·AuthRoutes· pages ·Controller· capabilities -
Data ·
Model·Query· sign-in · jobs ·Notify· payments · AI -
Interfaces · Snap ·
Snap\Cards·Snap\Conversation· testing · tooling · helper functions
-
Routing ·
-
Caligrafer: every command
- Project · build · data · agents · jobs and tests · maintenance · deploy
- Installation, configuration and Caligrafer
- Routing · Request · Controllers · Views
- Vue: flow of information · routes · validations
- Security and upgrading
- Release notes: 2.26 · 2.25 · 2.24 · 2.23 · 2.22 · 2.21 · 2.20 · 2.19 · 2.18 · 2.17 · 2.16 · 2.15 · 2.14 · 2.13 · 2.12 · 2.11 · 2.10 · 2.9 · 2.8 · 2.7 · 2.6 · 2.5 · 2.4 · 2.3 · 2.1 · October 2026 · changelog
- Testing Caligrafy (contributors)