src/Valkyrja/Config/Commands/ConfigCacheCommand.php
public function run(): int
    {
        // If the cache file already exists, delete it
        if (file_exists(config()['cacheFilePath'])) {
            unlink(config()['cacheFilePath']);
        }

        // If the config file exists
        if (file_exists(config()['filePath'])) {
            // Re-setup the application with it
            app()->setup(require config()['filePath'], true);
        } else {
            // Otherwise just re-setup the application with default configs
            app()->setup(null, true);
        }

        $cache = config();

        // Get the results of the cache attempt
        $result = file_put_contents(
            config()['cacheFilePath'],
            '<?php return ' . var_export($cache, true) . ';',
            LOCK_EX
        );

        if ($result === false) {
            output()->writeMessage(
                'An error occurred while generating config cache.',
                true
            );

            return 1;
        }

        output()->writeMessage('Config cache generated successfully', true);

        return 0;
    }
public function run(): int
    {
        // If the cache file already exists, delete it
        if (file_exists(config()['cacheFilePath'])) {
            unlink(config()['cacheFilePath']);
        }

        // If the config file exists
        if (file_exists(config()['filePath'])) {
            // Re-setup the application with it
            app()->setup(require config()['filePath'], true);
        } else {
            // Otherwise just re-setup the application with default configs
            app()->setup(null, true);
        }

        $cache = config();

        // Get the results of the cache attempt
        $result = file_put_contents(
            config()['cacheFilePath'],
            '<?php return ' . var_export($cache, true) . ';',
            LOCK_EX
        );

        if ($result === false) {
            output()->writeMessage(
                'An error occurred while generating config cache.',
                true
            );

            return 1;
        }

        output()->writeMessage('Config cache generated successfully', true);

        return 0;
    }
Run the command.

@return int