# Helpers for creating responses

Helper classes and traits for creating HttpSoft\Basis package responses.

# HttpSoft\Basis\Response\CustomResponseFactory

Custom factory for creating HttpSoft\Message\Response, implements Psr\Http\Message\ResponseFactoryInterface.

/**
 * @param array|null $headers
 * @param Psr\Http\Message\StreamInterface|string|resource $body
 * @param string $protocol
 */
public function __construct(
    array $headers = null,
    $body = 'php://temp',
    string $protocol = '1.1'
);

If $headers is not specified or is null, then ['Content-Type' => 'text/html; charset=UTF-8'] will be used. If you want to create a response without headers, pass an empty array.

Only one method defined in the Psr\Http\Message\ResponseFactoryInterface interface is used to create HttpSoft\Message\Response.

public function createResponse(
    int $statusCode = 200, 
    string $reasonPhrase = ''
): ResponseInterface;

Source code on GitHub.

# Traits for data organization

Helper traits are designed for convenience and to prevent code reuse.