for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace NotificationChannels\Webhook;
class WebhookMessage
{
/**
* The GET parameters of the request.
*
* @var array|string|null
*/
protected $query;
* The POST data of the Webhook request.
* @var mixed
protected $data;
* The headers to send with the request.
* @var array|null
protected $headers;
* The user agent header.
* @var string|null
protected $userAgent;
* The Guzzle verify option.
* @var bool|string
protected $verify = false;
* @param mixed $data
* @return static
public static function create($data = '')
return new static($data);
}
public function __construct($data = '')
$this->data = $data;
* Set the Webhook parameters to be URL encoded.
* @param mixed $query
* @return $this
public function query($query)
$this->query = $query;
return $this;
* Set the Webhook data to be JSON encoded.
public function data($data)
* Add a Webhook request custom header.
* @param string $name
* @param string $value
public function header($name, $value)
$this->headers[$name] = $value;
* Set the Webhook request UserAgent.
* @param string $userAgent
public function userAgent($userAgent)
$this->headers['User-Agent'] = $userAgent;
* Indicate that the request should be verified.
public function verify($value = true)
$this->verify = $value;
* @return array
public function toArray()
return [
'query' => $this->query,
'data' => $this->data,
'headers' => $this->headers,
'verify' => $this->verify,
];