PHPackages                             odinns/laravel-wayback-machine - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. odinns/laravel-wayback-machine

ActiveLibrary[File &amp; Storage](/categories/file-storage)

odinns/laravel-wayback-machine
==============================

Restore public Wayback Machine captures from Laravel into local files.

1.0.0(1mo ago)044↓100%[2 PRs](https://github.com/odinns/laravel-wayback-machine/pulls)MITPHPPHP 8.3.\* || 8.4.\*CI failing

Since Apr 30Pushed 2w agoCompare

[ Source](https://github.com/odinns/laravel-wayback-machine)[ Packagist](https://packagist.org/packages/odinns/laravel-wayback-machine)[ Docs](https://github.com/odinns/laravel-wayback-machine)[ RSS](/packages/odinns-laravel-wayback-machine/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (11)Versions (4)Used By (0)

Laravel Wayback Machine
=======================

[](#laravel-wayback-machine)

Restore existing Internet Archive Wayback Machine captures from Laravel.

This package lists public CDX captures, writes JSON manifests, and restores archived files into local storage for offline browsing. It does not create new archive.org captures. No Save Page Now. No live-site scraping dressed up as a feature.

Install
-------

[](#install)

```
composer require odinns/laravel-wayback-machine
```

Publish the config when you want to change defaults:

```
php artisan vendor:publish --tag=wayback-machine-config
```

Set a real User-Agent for your app:

```
WAYBACK_MACHINE_USER_AGENT="example-site-restore/1.0 (you@example.com)"
```

You can also override output paths when the Laravel default is not where you want files to land:

```
WAYBACK_MACHINE_MANIFESTS_PATH=/absolute/path/manifests
WAYBACK_MACHINE_CAPTURES_PATH=/absolute/path/captures
```

Start Small
-----------

[](#start-small)

List captures first:

```
php artisan wayback:list example.com --limit=25
```

If you care about the first rows CDX returns, use `--selection=all`. The default `latest-per-url` mode collapses repeated captures after CDX responds.

Dry-run a download:

```
php artisan wayback:download https://example.com --match=exact --dry-run --limit=1
```

Write a manifest:

```
php artisan wayback:manifest example.com --from=202001 --to=202012 --limit=500
```

Restore a bounded archived scope:

```
php artisan wayback:mirror example.com --limit=100 --delay-ms=2000
```

Unbounded restores are blocked in non-interactive runs. In an interactive terminal, you must confirm them. That friction is deliberate.

`wayback:mirror` starts with the selected page captures, fetches same-scope render assets like images and stylesheets, and rewrites local references when it can. It does not follow every normal link on the page. A download table should not turn into a surprise file harvest.

Use `--ignore-errors` when you want a local page even if some optional assets fail. The command will finish faster, but the output may be incomplete.

Commands
--------

[](#commands)

```
php artisan wayback:list {scope}
php artisan wayback:manifest {scope}
php artisan wayback:download {url-or-scope}
php artisan wayback:mirror {scope}
```

Shared options:

```
--match=host|prefix|exact
--from= --to=
--status= --mime=
--include= --exclude=
--selection=latest-per-url|unique-content|all
--collapse=
--limit= --page-limit=
--delay-ms=2000
--timeout=60
--user-agent="..."
--replay-root=https://web.archive.org
--follow-redirects
--ignore-errors
--dry-run
--json
--progress
--force
--output=/path

```

`--selection` is the friendly mode. `--collapse` is the raw CDX escape hatch.

`latest-per-url` keeps the newest capture for each normalized URL. `unique-content` deduplicates by digest. `all` keeps every matching capture.

API
---

[](#api)

```
use Odinns\LaravelWaybackMachine\CaptureManifest;
use Odinns\LaravelWaybackMachine\CaptureScope;
use Odinns\LaravelWaybackMachine\CdxQuery;
use Odinns\LaravelWaybackMachine\ManifestWriter;
use Odinns\LaravelWaybackMachine\WaybackClient;

$scope = CaptureScope::from('example.com', 'host');

$query = new CdxQuery(
    from: '202001',
    to: '202012',
    statuses: [200],
    mimeTypes: ['text/html'],
    limit: 100,
);

$captures = app(WaybackClient::class)->captures($scope, $query);

app(ManifestWriter::class)->write(
    new CaptureManifest($scope, $captures),
    storage_path('app/wayback-machine/manifests/example.json'),
);
```

Restored files use `id_` replay URLs by default. Toolbar replay URLs are still included in manifests for reference.

Output Layout
-------------

[](#output-layout)

Manifest default:

```
storage/app/wayback-machine/manifests/{safe-scope}-{timestamp}.json

```

Restored capture default:

```
storage/app/wayback-machine/captures/{scope}/{timestamp}/{safe-url-path}

```

Manifest entries include timestamp, original URL, replay URL, raw URL, status, MIME type, digest, length, and local path when restored.

Paths include query and port-sensitive parts so distinct URLs do not collapse into the same file.

Respect The Archive
-------------------

[](#respect-the-archive)

Defaults are conservative:

- selection: `latest-per-url`
- delay: `2000ms`
- retries: connection failures, `429`, `500`, `502`, `503`, `504`
- backoff: `1000`, `3000`, `10000`, `30000` ms

The Internet Archive is public infrastructure, not a private backup drive. Keep restores bounded. Use a clear User-Agent. Donate if this saves you work:

Development
-----------

[](#development)

Run the full local gate before pushing:

```
composer validate --strict
composer test:all
git diff --check
```

This package uses Testbench for command tests. In package development, Testbench writes Wayback output to this repository's `storage/` directory instead of hiding it under `vendor/orchestra`.

Versioning
----------

[](#versioning)

Composer versions come from Git tags. Do not add a `version` field to `composer.json`.

Contributing
------------

[](#contributing)

Keep changes small, tested, and boring in the right places. If you touch download or mirror behavior, test real edge cases: CDX parsing, retries, path collisions, local reference rewriting, and command guardrails.

Security
--------

[](#security)

Report security issues privately through GitHub Security Advisories when available:

```
https://github.com/odinns/laravel-wayback-machine/security/advisories/new

```

Downloaded captures are untrusted input. Do not execute restored files.

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md).

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

Non-Goals
---------

[](#non-goals)

This package does not:

- create new Wayback captures
- call Save Page Now
- ship Docker
- create migrations or Eloquent models
- classify site-specific spam or app-specific content

It reads what already exists and writes files. That is the job.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance95

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

40d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10bbe1cbea253f250b899d5704fbe59fc91ee40b14c017527409482187f365a1?d=identicon)[odinns](/maintainers/odinns)

---

Top Contributors

[![odinns](https://avatars.githubusercontent.com/u/10807424?v=4)](https://github.com/odinns "odinns (6 commits)")

---

Tags

laravelarchiveinternet-archivewayback-machine

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

### Embed Badge

![Health badge](/badges/odinns-laravel-wayback-machine/health.svg)

```
[![Health](https://phpackages.com/badges/odinns-laravel-wayback-machine/health.svg)](https://phpackages.com/packages/odinns-laravel-wayback-machine)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.1k3.4M80](/packages/unisharp-laravel-filemanager)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76318.2M110](/packages/laravel-mcp)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)

PHPackages © 2026

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