PHP code example of odinns / laravel-wayback-machine

1. Go to this page and download the library: Download odinns/laravel-wayback-machine library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

odinns / laravel-wayback-machine example snippets


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'),
);
bash
php artisan vendor:publish --tag=wayback-machine-config
bash
php artisan wayback:list {scope}
php artisan wayback:manifest {scope}
php artisan wayback:download {url-or-scope}
php artisan wayback:mirror {scope}