src/Primitive/String/String.php
public function replace($search, $replace)
    {
        $string = Stringy::create($this->string);

        $replace = $this->retrieveValue($replace);

        foreach ((array) $this->getSearchable($search) as $find)
        {
            $string = $string->replace($find, $replace);
        }

        return new static((string) $string);
    }
public function replace($search, $replace)
    {
        $string = Stringy::create($this->string);

        $replace = $this->retrieveValue($replace);

        foreach ((array) $this->getSearchable($search) as $find)
        {
            $string = $string->replace($find, $replace);
        }

        return new static((string) $string);
    }
Replaces all occurrences of $search by $replacement.

@param mixed $search
@param string|StringContract $replace
@return static