src/DotKey.php
public function put($key, $value)
    {
        $index = explode('.', $key);
        $err = null;
        
        self::setValue($this->item, $index, $value, $this->assoc ? 'array' : 'object', $err);
        
        if ($err) {
            $invalidPath = join('.', array_slice($index, 0, -1 * $err->incomplete));
            trigger_error("Unable to put '$key': '$invalidPath' is a {$err->var}", E_USER_WARNING);
        } // @codeCoverageIgnore
        
        return $this->item;
    }
public function put($key, $value)
    {
        $index = explode('.', $key);
        $err = null;
        
        self::setValue($this->item, $index, $value, $this->assoc ? 'array' : 'object', $err);
        
        if ($err) {
            $invalidPath = join('.', array_slice($index, 0, -1 * $err->incomplete));
            trigger_error("Unable to put '$key': '$invalidPath' is a {$err->var}", E_USER_WARNING);
        } // @codeCoverageIgnore
        
        return $this->item;
    }
Set a value, creating the structure if required

@param string  $key    The index to fetch in dot notation
@param mixed   $value
@return object|array