Casc
Table of Contents
Classes
- Commented
- A map entry's value with a comment `Writer` puts on the lines above
its key -- a `# was: env("APP_URL")` note for a migrated setting, say.
- MapValue
- An array `Writer` writes as a map -- a block -- whatever its shape:
the one way to say that an empty array is an empty map (`logger {}`)
rather than an empty list (`logger = []`), or that an array keyed
`0`, `1`, ... is a map keyed `"0"`, `"1"`, ....
A PHP array cannot say which it is, and both load back as the same
array, so `Writer` reads a bare one as a list. The difference is in
what the document means (CASC.md §5.4): written over a map that is
already there -- in an overlay, say -- `{}` merges and leaves it as it
is, where `[]` replaces it.
- Raw
- A value that is already CASC source, which `Writer` writes exactly as
given instead of as data: an environment reference
(`${DB_HOST:"127.0.0.1"}`), a tagged value (`!int(${PORT})`,
`!module("Foo.Bar")`), a duration (`5m`), an atom (`info`) -- anything
a plain PHP value cannot say.
- Secret
- A map entry's value whose key `Writer` marks secret (CASC.md §4.3):
`*password = "..."`, or `*database { ... }` for a block, every value
in which then loads as a secret. The value itself is written as if it
were not wrapped -- a scalar, a `Raw`, a list, a block.
- Writer
- Writes a PHP value tree as a CASC document (`casc/CASC.md` in
`joetjen/cooper`) that loads back as the same values -- the shared
writer behind every generated `.casc` file (a framework's existing
configuration converted, a scaffold).