PhpAmqpLib/Channel/AMQPChannel.php
public function basic_publish(
        $msg,
        $exchange = '',
        $routing_key = '',
        $mandatory = false,
        $immediate = false,
        $ticket = null
    ) {
        $pkt = new AMQPWriter();
        $pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket));

        try {
            $this->connection->send_content(
                $this->channel_id,
                60,
                0,
                mb_strlen($msg->body, 'ASCII'),
                $msg->serialize_properties(),
                $msg->body,
                $pkt
            );
        } catch (AMQPConnectionClosedException $e) {
            $this->do_close();
            throw $e;
        }

        if ($this->next_delivery_tag > 0) {
            $this->published_messages[$this->next_delivery_tag] = $msg;
            $this->next_delivery_tag = bcadd($this->next_delivery_tag, '1', 0);
        }
    }
public function basic_publish(
        $msg,
        $exchange = '',
        $routing_key = '',
        $mandatory = false,
        $immediate = false,
        $ticket = null
    ) {
        $pkt = new AMQPWriter();
        $pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket));

        try {
            $this->connection->send_content(
                $this->channel_id,
                60,
                0,
                mb_strlen($msg->body, 'ASCII'),
                $msg->serialize_properties(),
                $msg->body,
                $pkt
            );
        } catch (AMQPConnectionClosedException $e) {
            $this->do_close();
            throw $e;
        }

        if ($this->next_delivery_tag > 0) {
            $this->published_messages[$this->next_delivery_tag] = $msg;
            $this->next_delivery_tag = bcadd($this->next_delivery_tag, '1', 0);
        }
    }
public function basic_publish ( $ msg , $ exchange = '' , $ routing_key = '' , $ mandatory = false , $ immediate = false , $ ticket = null ) { $ pkt = new AMQPWriter ( ) ; $ pkt -> write ( $ this -> pre_publish ( $ exchange , $ routing_key , $ mandatory , $ immediate , $ ticket ) ) ; try { $ this -> connection -> send_content ( $ this -> channel_id , 60 , 0 , mb_strlen ( $ msg -> body , 'ASCII' ) , $ msg -> serialize_properties ( ) , $ msg -> body , $ pkt ) ; } catch ( AMQPConnectionClosedException $ e ) { $ this -> do_close ( ) ; throw $ e ; } if ( $ this -> next_delivery_tag > 0 ) { $ this -> published_messages [ $ this -> next_delivery_tag ] = $ msg ; $ this -> next_delivery_tag = bcadd ( $ this -> next_delivery_tag , '1' , 0 ) ; } }
Publishes a message

@param AMQPMessage $msg
@param string $exchange
@param string $routing_key
@param bool $mandatory
@param bool $immediate
@param int|null $ticket
Publishes a message