diff --git a/src/Lunr/Gravity/Filesystem/PhysicalFilesystemAccessObject.php b/src/Lunr/Gravity/Filesystem/PhysicalFilesystemAccessObject.php
index c8544af53be47f4d9cb82aea74497159d75dc4ff..0b18f368b0178864497fbd9906a48b4d75ad8812 100644
--- a/src/Lunr/Gravity/Filesystem/PhysicalFilesystemAccessObject.php
+++ b/src/Lunr/Gravity/Filesystem/PhysicalFilesystemAccessObject.php
@@ -240,6 +240,31 @@ class PhysicalFilesystemAccessObject implements DataAccessObjectInterface, Files
         }
     }
 
+    /**
+     * Generate a temporary file and return the path.
+     *
+     * @param string|null $prefix The prefix to the temp file
+     *
+     * @return bool|string
+     */
+    public function get_tmp_file($prefix = NULL)
+    {
+        $prefix = $prefix ?? uniqid();
+        return tempnam(sys_get_temp_dir(), $prefix);
+    }
+
+    /**
+     * Remove a file.
+     *
+     * @param string $file Filepath
+     *
+     * @return bool
+     */
+    public function rm($file): bool
+    {
+        return unlink($file);
+    }
+
     /**
      * Get the contents of a given file.
      *
diff --git a/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectRmTest.php b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectRmTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..5a9e48dce009c290ab3bef27dca669f18d59a71b
--- /dev/null
+++ b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectRmTest.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * This file contains the PhysicalFilesystemAccessObjectTmpTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @package    Lunr\Gravity\Filesystem
+ * @author     Heinz Wiesinger <heinz@m2mobi.com>
+ * @copyright  2013-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Filesystem\Tests;
+
+use Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject;
+
+/**
+ * This class contains tests for file related methods in the PhysicalFilesystemAccessObject.
+ *
+ * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject
+ */
+class PhysicalFilesystemAccessObjectTmpTest extends PhysicalFilesystemAccessObjectTest
+{
+
+    /**
+     * Test that rm() returns false if rm fails.
+     *
+     * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::rm
+     */
+    public function testGetTmpFileFails()
+    {
+        $this->mock_function('unlink', function (){return FALSE;});
+        $fetched = $this->class->rm('file');
+
+        $this->assertFalse($fetched);
+        $this->unmock_function('unlink');
+    }
+
+    /**
+     * Test that rm() returns true on success.
+     *
+     * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::rm
+     */
+    public function testGetTmpFileSucceedsWithoutPrefix()
+    {
+        $this->mock_function('unlink', function (){return TRUE;});
+        $fetched = $this->class->rm('file');
+
+        $this->assertTrue($fetched);
+        $this->unmock_function('unlink');
+    }
+
+}
+
+?>
diff --git a/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectTmpTest.php b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectTmpTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..e9d407d22bb0ed2f2e730d6effd9e56c27cddb7d
--- /dev/null
+++ b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectTmpTest.php
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * This file contains the PhysicalFilesystemAccessObjectTmpTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @package    Lunr\Gravity\Filesystem
+ * @author     Heinz Wiesinger <heinz@m2mobi.com>
+ * @copyright  2013-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Filesystem\Tests;
+
+use Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject;
+
+/**
+ * This class contains tests for file related methods in the PhysicalFilesystemAccessObject.
+ *
+ * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject
+ */
+class PhysicalFilesystemAccessObjectTmpTest extends PhysicalFilesystemAccessObjectTest
+{
+
+    /**
+     * Test that get_tmp_file() returns false from tempnam.
+     *
+     * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_tmp_file
+     */
+    public function testGetTmpFileFails()
+    {
+        $id = 0;
+        $this->mock_function('uniqid', function () use (&$id){$id++; return 'id';});
+        $this->mock_function('tempnam', function (){return FALSE;});
+        $fetched = $this->class->get_tmp_file();
+
+        $this->assertFalse($fetched);
+        $this->assertEquals(1, $id);
+        $this->unmock_function('tempnam');
+        $this->unmock_function('uniqid');
+    }
+
+    /**
+     * Test that get_tmp_file() returns a file from tempnam.
+     *
+     * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_tmp_file
+     */
+    public function testGetTmpFileSucceedsWithoutPrefix()
+    {
+        $id = 0;
+        $this->mock_function('uniqid', function () use (&$id){$id++; return 'id';});
+        $this->mock_function('tempnam', function (){return 'file';});
+        $fetched = $this->class->get_tmp_file();
+
+        $this->assertEquals('file', $fetched);
+        $this->assertEquals(1, $id);
+        $this->unmock_function('tempnam');
+        $this->unmock_function('uniqid');
+    }
+
+    /**
+     * Test that get_tmp_file() returns a file from tempnam with the provided prefix.
+     *
+     * @covers Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_tmp_file
+     */
+    public function testGetTmpFileSucceedsWithPrefix()
+    {
+        $id = 0;
+        $this->mock_function('uniqid', function () use (&$id){$id++; return 'id';});
+        $this->mock_function('tempnam', function (){return 'file';});
+        $fetched = $this->class->get_tmp_file('prefix');
+
+        $this->assertEquals('file', $fetched);
+        $this->assertEquals(0, $id);
+        $this->unmock_function('tempnam');
+        $this->unmock_function('uniqid');
+    }
+
+}
+
+?>
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index b8507fdeacd69f905aa6d7d646337dfbf5d036bc..badc41e0e5891c7b302366b9a1ed4a3401be96ad 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -170,6 +170,8 @@
             <file>../src/Lunr/Gravity/Database/Tests/DatabaseAccessObjectResultsTest.php</file>
             <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectBaseTest.php</file>
             <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectFileTest.php</file>
+            <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectTmpTest.php</file>
+            <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectRmTest.php</file>
             <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectListDirectoriesTest.php</file>
             <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectListFilesTest.php</file>
             <file>../src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectDirectoryTest.php</file>
