src/Primitive/Support/Abstracts/ComplexType.php
public function toFile($file, $jsonOptions = 0)
    {
        if (is_dir(pathinfo($file, PATHINFO_DIRNAME)))
        {
            return (bool) file_put_contents($file, $this->toJson($this->getIntegerable($jsonOptions)));
        }

        return false;
    }
public function toFile($file, $jsonOptions = 0)
    {
        if (is_dir(pathinfo($file, PATHINFO_DIRNAME)))
        {
            return (bool) file_put_contents($file, $this->toJson($this->getIntegerable($jsonOptions)));
        }

        return false;
    }
Write json representation of type value to file
You can specify second argument to call json_encode with params

@param $file
@param int|IntegerContract $jsonOptions
@return bool