Download the PHP package goldnead/statamic-identity-contracts without Composer

On this page you can find all versions of the php package goldnead/statamic-identity-contracts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-identity-contracts

Statamic Identity Contracts

Identity foundation for the Statamic addon family. It answers one question in a stable way — who did this? — so that addons never have to depend on a concrete App\Models\User.

This package owns no data: no migrations, no models, no Control Panel screens. It ships a value object, four contracts and inert defaults.

This is a library, not an addon

Despite the name, there is nothing Statamic-specific in here. It is a plain Laravel package: it does not require statamic/cms, references no Statamic class, registers no Control Panel screen and adds nothing a site owner can see or click. It is not listed on the Statamic Marketplace and should not be.

Install it if you are building an addon or an application that needs to record or notify an actor without reaching for the host application's user model. If you are running a Statamic site, you will get this package pulled in as a dependency of something else, and you never need to think about it.

Requirements

PHP 8.2+ (8.3+ when running Laravel 13)
Laravel 12.x or 13.x
Statamic not required, and not used

Laravel 11 is not supported: every laravel/framework v11 release is covered by security advisories, so Composer declines to install the line under its default policy.

Why it exists

Addon extraction has a recurring blocker: an addon needs to record or notify an actor, and reaches for the host application's user model. That single reference makes the addon unshippable. Identity breaks the dependency in both directions — the addon asks for an identity, the application decides what one is.

Install

Nothing to configure for the default behaviour. Publish the config if you need to change it:

The Identity value object

A readonly bag of scalars, safe to persist and to put on a queue:

Field Meaning
type user, contact, system, anonymous, or an app-defined type
id stringified identifier within that type
userId join key into the host application's user table
contactUuid join key into the CRM contact record
email, name convenience copies, personal data
anonymousId pseudonymous visitor id for pre-identification activity
meta free-form, application-defined

Copies rather than mutation: withContactUuid(), withEmail(), withAnonymousId(), withMeta().

pseudonymised() drops email, name and meta while keeping the join keys — this is what consumers call to honour retention rules without losing the ability to count what happened.

toArray() / fromArray() round-trip losslessly; the array keys are snake_case and match the column names a persisting consumer will want.

Resolving

resolve() accepts an Identity, anything implementing ProvidesIdentity, any Authenticatable, or an email string. Resolution order:

  1. registered custom resolvers (last registered wins)
  2. ProvidesIdentity::toIdentity()
  3. AuthenticatableIdentity::user(...), enriched with the CRM join key
  4. email string → contact lookup, else a contact-shaped identity without a uuid
  5. fallback

Unrecognised subjects never throw. Identity is metadata; a ledger write must not fail because an actor could not be classified. The fallback is Identity::anonymous() in HTTP and Identity::system() in the console.

current() returns the actingAs identity if one is set, otherwise the authenticated user, otherwise the fallback. It never returns null — "nobody in particular" is itself an identity.

Extension points

ProvidesIdentity — implement on your User model to control its representation completely:

IdentityResolver — teach the manager about a subject type it has never seen:

ContactLocator — bridges an email to a CRM contact. Default binding is a no-op, so any package may ask for a contact uuid without requiring a CRM to exist. Applications running LeadHub bind an implementation reading leadhub_contacts; that is the only place the join by email lives.

AnonymousIdResolver — supplies the pseudonymous visitor id. The bundled SessionAnonymousIdResolver stores a uuid in the existing session and deliberately sets no cookie of its own, so no additional consent surface is created. With anonymous.persist off it returns a one-way hash of the session id and writes nothing. With anonymous.enabled off it returns null forever.

Configuration

Headless applications that always pass the actor explicitly (API hubs, import pipelines) should set resolve_from_auth to false.

Privacy notes

Tests

Support

Only the latest version is supported. Bugs and questions go to GitHub issues; security reports go to the private channel named in SECURITY.md.

License

MIT — see LICENSE.


All versions of statamic-identity-contracts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package goldnead/statamic-identity-contracts contains the following files

Loading the files please wait ...