Spatie\DbDumper\Databases\MySql::dumpToFile PHP Method

dumpToFile() public method

Dump the contents of the database to the given file.
public dumpToFile ( string $dumpFile )
$dumpFile string
    public function dumpToFile(string $dumpFile)
    {
        $this->guardAgainstIncompleteCredentials();
        $tempFileHandle = tmpfile();
        fwrite($tempFileHandle, $this->getContentsOfCredentialsFile());
        $temporaryCredentialsFile = stream_get_meta_data($tempFileHandle)['uri'];
        $command = $this->getDumpCommand($dumpFile, $temporaryCredentialsFile);
        $process = new Process($command);
        if (!is_null($this->timeout)) {
            $process->setTimeout($this->timeout);
        }
        $process->run();
        $this->checkIfDumpWasSuccessFul($process, $dumpFile);
    }