mkdir

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 $cacheDir = $root.'/cache';

$cacheDir = $root.'/cache';

$viewsDir = $cacheDir.'/views';

if (! file_exists($cacheDir)) mkdir($cacheDir);

if (! file_exists($viewsDir)) mkdir($viewsDir);

$packagesCache = $cacheDir.'/packages.php';

file_put_contents($packagesCache, '<?php return [];');
<?php $cacheDir = $root.'/cache';

$viewsDir = $cacheDir.'/views';

if (! file_exists($cacheDir)) mkdir($cacheDir);

if (! file_exists($viewsDir)) mkdir($viewsDir);

$packagesCache = $cacheDir.'/packages.php';

file_put_contents($packagesCache, '<?php return [];');

$servicesCache = $cacheDir.'/services.php';
<?php     function can_test_component_using_magic_render()

    {

        mkdir($this->livewireViewsPath());

        file_put_contents($this->livewireViewsPath().'/foo.blade.php', <<<'PHP'

        <div>

            Im foo
<?php         </div>

        PHP);



        mkdir($this->livewireClassesPath());

        file_put_contents($this->livewireClassesPath().'/Foo.php', <<<'PHP'

        <?php
<?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'));