Skip to content

Documented dumpFile #2592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions components/filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,25 @@ isAbsolutePath returns true if the given path is absolute, false otherwise::
// return false
$fs->isAbsolutePath('../dir');

.. versionadded:: 2.3
``dumpFile`` is new in Symfony 2.3

dumpFile
~~~~~~~~

:method:`Symfony\\Component\\Filesystem\\Filesystem::dumpFile` allows you to
dump contents in a file. It does it in a atomic manner, that means it writes a
temporary file first and then moves that to the new place when it's finished.
This means the user does see either the old or the new state

.. code-block:: php

$fs->dumpFile('file.txt', 'Hello World');

The ``file.txt`` file contains ``Hello World`` now.

A desired file mode can be passed as third argument.

Error Handling
--------------

Expand Down