Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Makes directory
mkdir(    string $directory,    int $permissions 0777,    bool $recursive false,    ?resource $context null): bool
    public function makeDirectory($path$mode 0755$recursive false$force false)

    {

        if (
$force) {

            return @
mkdir($path$mode$recursive);

        }



        return 
mkdir($path$mode$recursive);
            return @mkdir($path$mode$recursive);

        }



        return 
mkdir($path$mode$recursive);

    }
    protected function ensureDirectoryExists($path)

    {

        if (! 
file_exists(dirname($path))) {

            @
mkdir(dirname($path), 0777true);

        }

    }
        if (! is_file($viewFile $directory.'/'.sha1($contents).'.blade.php')) {

            if (! 
is_dir($directory)) {

                
mkdir($directory0755true);

            }



            
file_put_contents($viewFile$contents);
    public function testCopy()

    {

        
$data '33232';

        
mkdir($this->tempDir.'/foo');

        
file_put_contents($this->tempDir.'/foo/foo.txt'$data);



        
$filesystemAdapter = new FilesystemAdapter($this->filesystem$this->adapter);
    public function testMove()

    {

        
$data '33232';

        
mkdir($this->tempDir.'/foo');

        
file_put_contents($this->tempDir.'/foo/foo.txt'$data);



        
$filesystemAdapter = new FilesystemAdapter($this->filesystem$this->adapter);
    public static function setUpTempDir()

    {

        
self::$tempDir sys_get_temp_dir().'/tmp';

        
mkdir(self::$tempDir);

    }
        $symlinkDir self::$tempDir.'/symlink_dir';

        
$symlink "{$symlinkDir}/symlink.txt";



        
mkdir($symlinkDir);

        
symlink($tempFile$symlink);
    public function testDeleteDirectory()

    {

        
mkdir(self::$tempDir.'/foo');

        
file_put_contents(self::$tempDir.'/foo/file.txt''Hello World');

        
$files = new Filesystem;

        
$files->deleteDirectory(self::$tempDir.'/foo');
    public function testDeleteDirectoryReturnFalseWhenNotADirectory()

    {

        
mkdir(self::$tempDir.'/bar');

        
file_put_contents(self::$tempDir.'/bar/file.txt''Hello World');

        
$files = new Filesystem;

        
$this->assertFalse($files->deleteDirectory(self::$tempDir.'/bar/file.txt'));
    public function testCleanDirectory()

    {

        
mkdir(self::$tempDir.'/baz');

        
file_put_contents(self::$tempDir.'/baz/file.txt''Hello World');

        
$files = new Filesystem;

        
$files->cleanDirectory(self::$tempDir.'/baz');
    public function testFilesMethod()

    {

        
mkdir(self::$tempDir.'/views');

        
file_put_contents(self::$tempDir.'/views/1.txt''1');

        
file_put_contents(self::$tempDir.'/views/2.txt''2');

        
mkdir(self::$tempDir.'/views/_layouts');
        mkdir(self::$tempDir.'/views');

        
file_put_contents(self::$tempDir.'/views/1.txt''1');

        
file_put_contents(self::$tempDir.'/views/2.txt''2');

        
mkdir(self::$tempDir.'/views/_layouts');

        
$files = new Filesystem;

        
$results $files->files(self::$tempDir.'/views');

        
$this->assertInstanceOf(SplFileInfo::class, $results[0]);
    public function testCopyDirectoryMovesEntireDirectory()

    {

        
mkdir(self::$tempDir.'/tmp'0777true);

        
file_put_contents(self::$tempDir.'/tmp/foo.txt''');

        
file_put_contents(self::$tempDir.'/tmp/bar.txt''');

        
mkdir(self::$tempDir.'/tmp/nested'0777true);
        mkdir(self::$tempDir.'/tmp'0777true);

        
file_put_contents(self::$tempDir.'/tmp/foo.txt''');

        
file_put_contents(self::$tempDir.'/tmp/bar.txt''');

        
mkdir(self::$tempDir.'/tmp/nested'0777true);

        
file_put_contents(self::$tempDir.'/tmp/nested/baz.txt''');



        
$files = new Filesystem;