src/Client.php
protected function send(array $data, array $tags = array())
    {
        $tagsData = $this->serializeTags(array_replace($this->tags, $tags));

        try {
            $socket = $this->getSocket();
            $messages = array();
            $prefix = $this->namespace ? $this->namespace . '.' : '';
            foreach ($data as $key => $value) {
                $messages[] = $prefix . $key . ':' . $value . $tagsData;
            }
            $this->message = implode("\n", $messages);
            @fwrite($socket, $this->message);
            fflush($socket);
        } catch (ConnectionException $e) {
            if ($this->throwConnectionExceptions) {
                throw $e;
            } else {
                trigger_error(
                    sprintf('StatsD server connection failed (udp://%s:%d)', $this->host, $this->port),
                    E_USER_WARNING
                );
            }
        }

        return $this;
    }
protected function send(array $data, array $tags = array())
    {
        $tagsData = $this->serializeTags(array_replace($this->tags, $tags));

        try {
            $socket = $this->getSocket();
            $messages = array();
            $prefix = $this->namespace ? $this->namespace . '.' : '';
            foreach ($data as $key => $value) {
                $messages[] = $prefix . $key . ':' . $value . $tagsData;
            }
            $this->message = implode("\n", $messages);
            @fwrite($socket, $this->message);
            fflush($socket);
        } catch (ConnectionException $e) {
            if ($this->throwConnectionExceptions) {
                throw $e;
            } else {
                trigger_error(
                    sprintf('StatsD server connection failed (udp://%s:%d)', $this->host, $this->port),
                    E_USER_WARNING
                );
            }
        }

        return $this;
    }
protected function send ( array $ data , array $ tags = array ( ) ) { $ tagsData = $ this -> serializeTags ( array_replace ( $ this -> tags , $ tags ) ) ; try { $ socket = $ this -> getSocket ( ) ; $ messages = array ( ) ; $ prefix = $ this -> namespace ? $ this -> namespace . '.' : '' ; foreach ( $ data as $ key => $ value ) { $ messages [ ] = $ prefix . $ key . ':' . $ value . $ tagsData ; } $ this -> message = implode ( "\n" , $ messages ) ; @ fwrite ( $ socket , $ this -> message ) ; fflush ( $ socket ) ; } catch ( ConnectionException $ e ) { if ( $ this -> throwConnectionExceptions ) { throw $ e ; } else { trigger_error ( sprintf ( 'StatsD server connection failed (udp://%s:%d)' , $ this -> host , $ this -> port ) , E_USER_WARNING ) ; } } return $ this ; }
Send Data to StatsD Server
@param  array $data A list of messages to send to the server
@param  array $tags A list of tags to send to the server
@return $this
@throws ConnectionException If there is a connection problem with the host
Send Data to StatsD Server