Download the PHP package webdna/auditor without Composer

On this page you can find all versions of the php package webdna/auditor. 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 auditor

Auditor

An audit log for Craft CMS. Anyone you give permission to can answer "who changed this, when, from where, and what did it say before?" — and "who signed in, who failed to, and who was given access?" — from the control panel, without reading log files or the database.

Contents

Requirements

Installation

From the Plugin Store: search for "Auditor" and install it.

With Composer:

Recording starts as soon as the plugin is installed. Nothing is recorded from before then.

Editions

Both editions record exactly the same things. They differ in where you can read them.

Lite Pro
The log screen, its filters and each row's detail ✓ ✓
Retention, redaction and deleted-user handling ✓ ✓
History on each entry, asset, product or user ✓
Activity on each user: what they changed, and what happened to their account ✓

Moving from Lite to Pro shows History and Activity for everything already recorded.

What is recorded

Every row says who did it (the actor), what it happened to (the subject), when, from which context — control panel, site, console or queue, with the route, command or job — and, for web requests, the IP address and browser. Rows written in one request share a request id, so the log can show "everything else this request did".

Content changes

Event Recorded
Created The new element's non-empty field values and attributes
Saved Each field and attribute that changed, with its value before and after
Deleted, Restored The element and who did it
Moved A structure move: where it went
Batch One row for a large operation (see below)

A save that changed nothing writes no row. The before value is read from what Craft stored, so a form that re-posts every field is recorded as changing only what actually changed.

Alongside custom fields, these attributes are tracked:

Element type Attributes
Entries title, slug, enabled, enabled for site, post date, expiry date, authors, entry type, section
Users email, username, full name, first name, last name, admin, photo
Assets title, filename, folder, volume, alt text
Categories, tags title, slug, enabled
Commerce orders order status, paid status, email, coupon code
Commerce products title, enabled
Commerce variants title, enabled, SKU, base price, base promotional price

Not recorded: drafts, provisional drafts, autosaves, revisions, and the copies Craft makes when it propagates a save to other sites. Publishing a draft is recorded — it is the change people care about. A nested entry's change rolls up under its owner, so publishing an entry with three edited blocks reads as one change with three beneath it.

Batches

An operation is recorded as one batch row when it is a resave (resave/* commands, or a resave Craft queues after a settings change), a batched queue job, an element-index action on more than one element, or any single operation touching more than bulkThreshold top-level elements (10 by default). The row says what the operation was, the element type, how many, and who ran it; every element it covered is listed, so each one's History reads "Included in a re-save of 1,240 entries".

A batch takes no before-snapshots and records no per-element changes, which is what keeps a large resave fast. Set recordBulkDiffs to record each element in full instead.

A batched job that Craft splits over several queue runs writes one batch row per run.

Sign-ins and accounts

Signed in · signed out · failed sign-in (the attempted username and Craft's real reason — never the password) · locked · unlocked · suspended · unsuspended · activated · deactivated · email changed · email verified · password changed · password reset required · authenticator app added or removed · passkey added or removed.

Sign-ins by a "Keep me signed in" cookie are not recorded unless recordCookieLogins is on. Two-step methods that other plugins add are not recorded.

Access

Groups added or removed · permissions changed · admin rights given or taken · a user group created, changed (name, handle, description, permissions) or deleted · one user signing in as another.

When someone signs in as another user, that row names both, and every row written in that session carries the original user as well.

A user group changed by applying project config on a deploy is recorded too, with the console as its context.

Craft Commerce orders

Orders are recorded once they are completed. Carts never are, and filling a cart costs the log nothing. A completed order's save row shows its status and email changes as any element's do, and also its line items added, removed or changed (purchasable, SKU, quantity, sale price, options, notes, status) and its adjustments (type, name, amount, included, and the line item each applies to).

Stock movements are not recorded: Commerce moves stock through inventory transactions, which save no element.

Configuration

Settings are code, deployed with the rest of the site. There is no settings screen. Copy examples/config/auditor.php to config/auditor.php and change what you need; every value it shows is the default. As with any Craft config file, it may be keyed by environment.

Setting Default Does
enabled true false stops all recording. Nothing already recorded is removed.
contexts ['cp', 'site', 'console', 'queue'] The contexts recorded. Leave one out to stop recording from it.
excludeElementTypes [] Element classes never recorded, e.g. [\craft\elements\Asset::class].
redact ['password', 'newPassword', 'verificationCode', 'authKey'] Field handles and attribute names recorded as "changed" without their value.
retentionDays 365 Days a row is kept. 0 keeps every row.
bulkThreshold 10 Top-level elements one operation may touch before it is recorded as a batch.
recordBulkDiffs false Record each element in a batch as its own row, with its changes. Slows resaves and large bulk actions.
recordNoChangeSaves false Record a save even when no value changed.
recordCookieLogins false Record sign-ins made by a "Keep me signed in" cookie.

Redaction applies everywhere a value would appear: a new element's values, a save's changes, and the payload of sign-in and access rows. A redacted value is recorded as having changed, so the log still shows that a tax number was edited, and by whom, without keeping the number.

Permissions

Permission Lets someone
Access Auditor (Craft's own plugin permission) Open the log and each row's detail
See the address and browser each event came from See IP addresses and browsers. Everyone else sees "—".
See the history of what they can view (Pro) Open History on an element they can view
See what each user changed and what happened to their account (Pro) Open a user's Activity. Another user's also needs Craft's View users.

Admins hold all of them. No permission lets anyone edit or delete a row — an audit log that can be edited is not an audit log.

The control panel

The log is the Auditor item in the control panel's navigation. Filter by kind (content, sign-in, access), event, element type, person, context, site and date range; search matches the subject's and the person's names. Open any row for its detail: a Field / Before / After table for a save, the line items and adjustments for an order, or the payload for a sign-in or access event, with a link to everything else the same request did. Long values are cut at 500 characters with a control to show the rest. Nothing logged is ever rendered as HTML.

History (Pro) is in each element's action menu (the ⋯ button on its edit screen). It lists the element's changes newest first, one row per publish with its nested entries' changes beneath, and the batches it was part of. It loads only when opened, so it adds nothing to the edit screen.

Activity (Pro) is a screen on each user, beside their profile and permissions, with two tabs:

Console commands

--days below 1 is refused. Each command exits non-zero on failure.

Extension points

Add or remove tracked attributes

Each attribute maps to where its stored value is read: 'table.column' for a column (elements and elements_sites are the element's own rows; any other table is joined on its id), or a Closure(ElementInterface $element): mixed that returns the stored value itself. The new value is always read as $element->{$name}. The event is raised once per element type.

Add your own state to an element's row

Differ::EVENT_DEFINE_ELEMENT_SNAPSHOT lets any code record state that is neither a field nor an attribute. It is raised before a save, with $event->before null, for the handler to read each key's stored state into $event->values; and after the save, with $event->before holding what was read, for the handler to give each key's state now. A key whose two values differ is recorded like a field. To word the change yourself, set $event->changes[$key] to {label, old, new}, or to a list of items — {label, fields, added, removed, changed} — which the detail screen draws as a table. The Commerce order differ is built on this event. It is raised only while something listens.

Read the before state from the database, not by loading the element. Values you add are redacted by the redact setting like any other.

Change or skip a row before it is recorded

$event->row is a webdna\auditor\models\Event: family, event, the subject (elementId, elementType, siteId, elementLabel), the actor (actorId, actorLabel), context, contextDetail and data.

Record an event of your own

The person, context, request id and address are filled in for anything you leave unset, and the row is written with the request's others, after its transaction commits.

Personal data

The log holds personal data: IP addresses, browsers, email addresses, and the values people typed into fields. Auditor gives you the controls; your site's privacy notice should say that it keeps an audit log, what it holds and for how long.

Auditor sends nothing anywhere: no email, notification or webhook.

Performance

Troubleshooting

Nothing is being recorded. Check enabled and contexts in config/auditor.php for the current environment, and that the element type is not in excludeElementTypes. Drafts and autosaves are never recorded; publish the draft.

A save I made is missing. If the save was rolled back — a validation error, or an exception later in the same transaction — it was never committed and is not recorded. A savepoint rolled back inside a transaction that then commits cannot be detected; its changes are recorded as if they stood.

A resave shows one row, not one per entry. That is a batch. Open it to see the operation and count, or set recordBulkDiffs to record each element.

History or Activity is missing. Both are Pro, and each needs its permission. History is not offered on an unpublished draft.

Recording failed. Auditor never lets a failure stop a save or sign-in. Failures are logged to the auditor log category: look in storage/logs/.

Uninstalling

Uninstalling drops Auditor's two tables, auditor_events and auditor_event_elements, and every row in them. To keep the log, back up those tables first.

Auditor's schema starts at 2.0.0 and its tables are also created by a migration, so it can replace an older plugin with the handle auditor. That plugin's own tables are never read, changed or dropped.

Support

Report a problem at github.com/webdna/auditor/issues.


All versions of auditor with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.6
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 webdna/auditor contains the following files

Loading the files please wait ...