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

    {

        if ($force) {

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

        }



        return mkdir($path, $mode, $recursive);
<?php             return @mkdir($path, $mode, $recursive);

        }



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

    }
<?php     protected function ensureDirectoryExists($path)

    {

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

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

        }

    }
<?php         if (! file_exists($echoScriptPath = $this->laravel->resourcePath('js/echo.js'))) {

            if (! is_dir($directory = $this->laravel->resourcePath('js'))) {

                mkdir($directory, 0755, true);

            }



            copy(__DIR__.'/stubs/echo-js.stub', $echoScriptPath);
<?php         if (! is_file($viewFile = $directory.'/'.hash('xxh128', $contents).'.blade.php')) {

            if (! is_dir($directory)) {

                mkdir($directory, 0755, true);

            }



            file_put_contents($viewFile, $contents);
<?php     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);
<?php     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);
<?php     public static function setUpTempDir()

    {

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

        mkdir(self::$tempDir);

    }



    #[AfterClass]
<?php         $symlinkDir = self::$tempDir.'/symlink_dir';

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



        mkdir($symlinkDir);

        symlink($tempFile, $symlink);
<?php     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');
<?php     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'));
<?php     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');
<?php     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');
<?php         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]);
<?php     public function testCopyDirectoryMovesEntireDirectory()

    {

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

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

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

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