src/Utils/Dotenv.php
protected function writeLine($line, $number = null)
    {
        $this->ensureFileIsWritable();

        // Append
        if (is_null($number)) {
            return file_put_contents($this->filePath, $line . PHP_EOL, FILE_APPEND);
        }

        // Replace
        $lines = $this->readLinesFromFile($this->filePath);
        $lines[$number] = $line;
        return file_put_contents($this->filePath, implode(PHP_EOL, $lines));
    }
protected function writeLine($line, $number = null)
    {
        $this->ensureFileIsWritable();

        // Append
        if (is_null($number)) {
            return file_put_contents($this->filePath, $line . PHP_EOL, FILE_APPEND);
        }

        // Replace
        $lines = $this->readLinesFromFile($this->filePath);
        $lines[$number] = $line;
        return file_put_contents($this->filePath, implode(PHP_EOL, $lines));
    }
protected function writeLine ( $ line , $ number = null ) { $ this -> ensureFileIsWritable ( ) ; // Append if ( is_null ( $ number ) ) { return file_put_contents ( $ this -> filePath , $ line . PHP_EOL , FILE_APPEND ) ; } // Replace $ lines = $ this -> readLinesFromFile ( $ this -> filePath ) ; $ lines [ $ number ] = $ line ; return file_put_contents ( $ this -> filePath , implode ( PHP_EOL , $ lines ) ) ; }
Write a line to the dotenv file.
@param string $line The line to write
@param integer|null $number Write to a specific location
@return mixed
Write a line to the dotenv file .