Skip to content

Behaviors

Ten ORM behaviors covering the patterns that appear across most CakePHP applications.

BehaviorPurpose
AfterSaveHook for queueing follow-up work after an entity save.
BitmaskedStore a set of flags / enum values as a single bitmask integer column.
EncryptionTransparent column-level encryption / decryption on save & find.
JsonableAutomatic JSON encode/decode for fields stored as JSON.
PasswordablePassword change flow with confirm + current-password validation.
ResetReset / recompute denormalized fields across rows.
SluggedAuto-generate URL slugs from a source field.
StringString-related field manipulation (whitespace, casing, etc.).
ToggleBoolean-flag toggling with constraints (e.g. only one active).
TypographicTypographic cleanup of text fields (smart quotes, dashes, etc.).

To use any behavior in a Table:

php
public function initialize(array $config): void {
    parent::initialize($config);
    $this->addBehavior('Tools.Bitmasked');
}

Released under the MIT License.