Skip to content


Subversion checkout URL

You can clone with
Download ZIP
[READ-ONLY] Subtree split of the Symfony Filesystem Component -- clone into Symfony/Component/ (master at symfony/symfony)

Merge branch '2.8'

* 2.8:
  Added 'default' color
  [HttpFoundation] Reload the session after regenerating its id
  [HttpFoundation] Add a test case to confirm a bug in session migration
  [Serializer] Fix ClassMetadata::sleep()
  [2.6] Static Code Analysis for Components and Bundles
  [Finder] Command::addAtIndex() fails with Command instance argument
  [DependencyInjection] Freeze also FrozenParameterBag::remove
  [Twig][Bridge] replaced `extends` with `use` in bootstrap_3_horizontal_layout.html.twig
  fix CS
  fixed CS
  Add a way to reset the singleton
  [Security] allow to use `method` in XML configs
  [Serializer] Fix Groups tests.
  Remove duplicate example
  Remove var not used due to returning early (introduced in 8982c32)
  [Serializer] Fix Groups PHPDoc
  Enhance hhvm test skip message
  fix for legacy asset() with EmptyVersionStrategy
  [Form] Added upgrade notes for #15061
latest commit 8b4a1ddbdc
@fabpot fabpot authored

Filesystem Component

Filesystem provides basic utility to manipulate the file system:


use Symfony\Component\Filesystem\Filesystem;

$filesystem = new Filesystem();

$filesystem->copy($originFile, $targetFile, $override = false);

$filesystem->mkdir($dirs, $mode = 0777);

$filesystem->touch($files, $time = null, $atime = null);



$filesystem->chmod($files, $mode, $umask = 0000, $recursive = false);

$filesystem->chown($files, $user, $recursive = false);

$filesystem->chgrp($files, $group, $recursive = false);

$filesystem->rename($origin, $target);

$filesystem->symlink($originDir, $targetDir, $copyOnWindows = false);

$filesystem->makePathRelative($endPath, $startPath);

$filesystem->mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array());



You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/Filesystem/
$ composer install
$ phpunit
Something went wrong with that request. Please try again.