Download the PHP package patrixsmart/adjustfly without Composer

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

Adjustfly

Record Laravel model adjustments — a lightweight, polymorphic audit trail for your Eloquent models.

Supports Laravel 12 and 13. Laravel 12 needs PHP 8.2+; Laravel 13 needs PHP 8.3+.

Installation

Publish the config and the migration, then migrate:

The migration is not run from the package — publishing is required. The schema then lives in your own repository, where it shows up in code review, can be edited before it is ever run, and is never changed underneath you by a composer update.

Open the published migration before migrating if your models use UUID or ULID keys; it ships with morphs() and an integer user_id, and carries comments showing the alternatives.

Usage

Track a model

Add the HasAdjustments trait. That is all — adjustments are recorded automatically on every update.

Nothing is written when an update changes no tracked attribute, so touch() and no-op saves will not fill your table with empty rows.

Both sides of the payload store cast values, so an array column stays an array and a datetime column serialises as ISO-8601 — before and after are always directly comparable.

Choose which events are recorded

Prefer to record by hand? Set record_automatically => false and call:

Control which attributes are recorded

Globally, in config/adjustfly.php:

Per model — add to the exclusion list, or restrict to a whitelist:

Name the record

Every adjustment stores adjustable_label - a human name for the record it belongs to, captured when the row is written.

It is stored rather than resolved on read for two reasons: a name that only exists on the record cannot be searched for, and a hard-deleted record cannot be loaded back at all - so without this the trail forgets what it was about.

The first of adjustfly.label_attributes that holds a value wins:

When a model's identity is not in a single attribute, it can say what it is called itself:

Returning null is fine - not every model has a name worth recording. Labels are truncated to 255 characters, so an unexpectedly long value can never fail the insert and lose the adjustment with it.

Suppress recording temporarily

Useful in seeders, imports and data backfills:

Attribute the change to a user

The acting user is resolved from the guard in adjustfly.user.guard (the default guard when null), and is simply null for console and queue work.

Querying

Reacting to adjustments

Pruning

Adjustments grow quickly. adjustfly:prune deletes anything older than prune_after_days (default 365):

Schedule it daily:

Set prune_after_days to null to keep adjustments forever — the command then reports that pruning is disabled and exits cleanly, so it is safe to leave scheduled.

Use adjustfly:prune rather than Laravel's model:prune. The latter only auto-discovers models in your own app/Models directory, so it will run successfully and prune no adjustments at all. adjustfly:prune names the configured model explicitly and then delegates to model:prune, so chunking, the ModelsPruned event and soft-delete handling are unchanged. If you prefer calling it directly: php artisan model:prune --model="Patrixsmart\Adjustfly\Models\Adjustment"

HTTP routes

The package ships read-only index/show endpoints, disabled by default. Adjustment rows contain the before/after state of your models, so exposing them is an explicit, deliberate choice.

To enable them:

1. Write a policy and register it:

2. Turn the routes on:

Without a policy Laravel denies by default, so the endpoints return 403 rather than leaking data.

Configuration reference

Key Default Purpose
model Adjustment::class Swap in your own subclass
table adjustments Table name
record_automatically true Hook model events automatically
events ['updating'] Events that produce an adjustment
excluded_attributes passwords, tokens, timestamps Never recorded
label_attributes name, title, label, … Attributes tried when naming a record
capture_request_context true Store IP address and user agent
user.model / user.guard auth defaults Who is credited
user.foreign_key user_id User column on the adjustments table
routes.enabled false Expose the HTTP endpoints
prune_after_days 365 Retention for adjustfly:prune

Upgrading from 2.x

3.0 adds the adjustable_label column, and the package writes to it on every adjustment - so the column has to exist before you upgrade.

Since 2.1 the migration lives in your application rather than the package, which means it will not change on its own. Add the column to your published migration and re-run it, or write a small migration of your own:

Existing rows keep a null label; nothing else changes. If you would rather not store labels at all, set label_attributes to [] and override adjustmentLabel() to return null - the column stays empty but must still be present.

Upgrading from 2.0

2.1 carries two breaking changes despite the minor version bump — 2.0.0 had only just been published when they landed.

Upgrading from 1.x

2.x is a breaking release. Everything under Upgrading from 2.0 applies too.

Testing

License

MIT. See LICENSE.


All versions of adjustfly 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 patrixsmart/adjustfly contains the following files

Loading the files please wait ...