Skip to content

Format 2.0+

📝 Name: format · 🚨 Required · 🖥️ Option: -f, --format · 🐝 Default: text

The formatter used to print the cache warmup result.

JSON formatter: json

This formatter can be used to format user-oriented output as JSON object.

bash
./cache-warmup.phar -f json
./cache-warmup.phar --format json
json
{
    "format": "json"
}
php
use EliasHaeussler\CacheWarmup;

return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
    $config->useJsonFormat();

    return $config;
};
yaml
format: json
bash
CACHE_WARMUP_FORMAT=json

Data structure

The resulting JSON object includes the following properties:

PropertyDescription
cacheWarmupResultLists all crawled URLs, grouped by their crawling state (failure, success), and may contain cancelled state
messagesContains all logged messages, grouped by message severity (error, info, success, warning)
parserResultLists all parsed and excluded XML sitemaps and URLs, grouped by their parsing state (excluded, failure, success)
timeLists all tracked times during cache warmup (crawl, parse)

The complete JSON structure can be found in the provided JSON schema.

Example output
json
{
    "cacheWarmupResult": {
        "cancelled": [
            "https://www.google.com/intl/de/forms/about/",
            "https://www.google.com/intl/cs/forms/about/",
            "https://www.google.com/intl/et/forms/about/",
            "https://www.google.com/intl/es/forms/about/",
            "https://www.google.com/intl/es-419/forms/about/"
        ],
        "failure": [
            "https://www.google.com/intl/en-gb/forms/about/"
        ],
        "success": [
            "https://www.google.com/forms/about/",
            "https://www.google.com/intl/af/forms/about/",
            "https://www.google.com/intl/ca/forms/about/",
            "https://www.google.com/intl/id/forms/about/",
            "https://www.google.com/intl/ms/forms/about/",
            "https://www.google.com/intl/da/forms/about/"
        ]
    },
    "parserResult": {
        "excluded": {
            "sitemaps": [
                "https://www.google.com/gmail/sitemap.xml"
            ]
        },
        "failure": {
            "urls": [
                "https://www.google.com/intl/zu/forms/about/"
            ]
        },
        "success": {
            "sitemaps": [
                "https://www.google.com/sitemap.xml",
                "https://www.google.com/forms/sitemaps.xml"
            ],
            "urls": [
                "https://www.google.com/forms/about/",
                "https://www.google.com/intl/af/forms/about/",
                "https://www.google.com/intl/id/forms/about/",
                "https://www.google.com/intl/ca/forms/about/",
                "https://www.google.com/intl/da/forms/about/",
                "https://www.google.com/intl/ms/forms/about/",
                "https://www.google.com/intl/en-gb/forms/about/"
            ]
        }
    },
    "time": {
        "parse": "0.18s",
        "crawl": "0.212s"
    }
}

Text formatter: text

This is the default formatter that is used if no other formatter is explicitly configured. It writes all user-oriented output to the console.

bash
./cache-warmup.phar -f text
./cache-warmup.phar --format text
json
{
    "format": "text"
}
php
use EliasHaeussler\CacheWarmup;

return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
    $config->useTextFormat();

    return $config;
};
yaml
format: text
bash
CACHE_WARMUP_FORMAT=text

Released under the GNU General Public License 3.0 (or later)