PHPackages                             pderas/archivalist - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pderas/archivalist

ActiveLibrary

pderas/archivalist
==================

v2.2.0(3y ago)08.1k↓50%[3 issues](https://github.com/PDERAS/archivalist/issues)MITPHPPHP ^7.3|^8.0

Since Jul 9Pushed 3y ago3 watchersCompare

[ Source](https://github.com/PDERAS/archivalist)[ Packagist](https://packagist.org/packages/pderas/archivalist)[ Docs](https://github.com/pderas/archivalist)[ RSS](/packages/pderas-archivalist/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (5)Versions (10)Used By (0)

Archivalist
===========

[](#archivalist)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c78dba6b21e3673a97df901dad8c1e642101cb954503a4c1a0182024737e7354/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7064657261732f617263686976616c6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pderas/archivalist)[![Total Downloads](https://camo.githubusercontent.com/50f90687ebcef52e4a7b44719a56f6aff7b66a8818044890a2eeaa11d938d3f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7064657261732f617263686976616c6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pderas/archivalist)

Archivalist is a minimal package designed to make archiving changes to Laravel models easy.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require pderas/archivalist
```

Usage
-----

[](#usage)

Simply add the `Pderas\Archivalist\Traits\HasArchives` to any model you wish to archive.

```
use Pderas\Archivalist\Traits\HasArchives;
class Post extends Model {
    use HasArchives;
}
```

If you wish certain columns to *always* be archived, this can be accomplished by adding wither a `archived` property or method to the model

```
use Pderas\Archivalist\Traits\HasArchives;
class Post extends Model {
    use HasArchives;

    protected $archived = [
        'updated_at'
    ];

    // Alternatively...
    protected function archived() {
        return [
            'updated_at' => $this->getOriginal('updated_at'),
            'is_archived' => true
        ];
    }
}
```

Archives can be 'rehydrated' into the state of the original model

```
$user->company = 'Pderas';
$user->save();

$archive = $user->archives()->first(); // => \Pderas\Archivalist\Models\Archive
$original = $archive->rehydrate(); // => \App\User
```

A Collection with the full history of the model can be acquired using `->getHistory()`

```
$user->getHistory(); // A user model for every state the user was in
```

Mass assignment is not supported, in which case you must use the following workaround:

```
//  Do not do
Post::where('status','open')
    ->update(['status','closed']); // This will fail

//  Do this instead
Archivalist::proxy(Post::query())
    ->where('status','open')
    ->update(['status','closed']);
```

Support for beforeArchive has been added. Implement the method `beforeArchive` on any model which uses `HasArchives` trait to run any extra logic before the primary archives logic is ran.

```
// SomeModel which uses HasArchives

public function beforeArchive() {
    //  Put logic here to be ran before the primary archives logic is ran
    //  useful for automating tasks such as always writing user->id, etc
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Reed Jones](https://github.com/pderas)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~121 days

Recently: every ~241 days

Total

9

Last Release

1156d ago

Major Versions

v0.2.3 → v1.0.02021-10-22

v1.0.1 → v2.0.02022-08-10

PHP version history (2 changes)v0.1.0PHP ^7.3

v2.2.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd002f7189f7950719be52a60db3cfb36064bed39319a027eacb5b79379d9146?d=identicon)[reed-jones](/maintainers/reed-jones)

---

Top Contributors

[![striderwhite](https://avatars.githubusercontent.com/u/6131739?v=4)](https://github.com/striderwhite "striderwhite (18 commits)")[![reed-jones](https://avatars.githubusercontent.com/u/11511864?v=4)](https://github.com/reed-jones "reed-jones (9 commits)")[![brockroadhouse](https://avatars.githubusercontent.com/u/4275501?v=4)](https://github.com/brockroadhouse "brockroadhouse (4 commits)")[![drewbindon](https://avatars.githubusercontent.com/u/35608232?v=4)](https://github.com/drewbindon "drewbindon (2 commits)")

---

Tags

pderasarchivalist

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/pderas-archivalist/health.svg)

```
[![Health](https://phpackages.com/badges/pderas-archivalist/health.svg)](https://phpackages.com/packages/pderas-archivalist)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
