<?php

/**
 * Ensures the storage directory structure exists.
 *
 * Called by Composer post-install/post-update hooks so that fresh clones
 * get the directories Laravel expects, even though storage/ is gitignored.
 */

$directories = [
    'storage/app/public',
    'storage/cache',
    'storage/framework/cache/data',
    'storage/framework/sessions',
    'storage/framework/testing',
    'storage/framework/views',
    'storage/logs',
    'bootstrap/cache',
];

foreach ($directories as $dir) {
    if (!is_dir($dir)) {
        mkdir($dir, 0755, true);
        echo "Created {$dir}" . PHP_EOL;
    }
}
