PHP code example of keyagency / statamic-asset-usage

1. Go to this page and download the library: Download keyagency/statamic-asset-usage 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/ */

    

keyagency / statamic-asset-usage example snippets


return [
    // '*' for all containers, or ['main', 'documents']
    'containers' => '*',

    // The complete set: a type you leave out is not scanned
    'scanned_types' => [
        'entries' => true,
        'globals' => true,
        'terms' => true,
        'navs' => true,
        'users' => true,
        'assets' => true,
        'form_submissions' => true,
        'collection_cascades' => true,
        'taxonomy_cascades' => true,
        'addon_settings' => true,
        'blueprints' => true,
    ],

    // Days without a full rebuild before the Tools page suggests one. 0 turns it off.
    'rebuild_reminder_days' => [
        'auto_update' => 30,
        'manual' => 7,
    ],

    // Also count plain /assets/… URLs typed into text fields
    'scan_urls' => true,

    // An asset in an unpublished draft counts as used
    '
bash
php artisan vendor:publish --tag=asset-usage-config