Title: HttplugFactory
Published: May 20, 2026
Last modified: August 20, 2026

---

# class HttplugFactory {}

## In this article

 * [Methods](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/?output_format=md#methods)
 * [Source](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/?output_format=md#source)

[ Back to top](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/?output_format=md#wp--skip-link--target)

This class has been deprecated since since version 1.8, use Psr17Factory instead.
since version 1.8, use Psr17Factory instead

## 󠀁[Methods](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/?output_format=md#methods)󠁿

| Name | Description | 
| [HttplugFactory::createRequest](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/createrequest/) | – | 
| [HttplugFactory::createResponse](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/createresponse/) | – | 
| [HttplugFactory::createStream](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/createstream/) | – | 
| [HttplugFactory::createUri](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/createuri/) | – |

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory/?output_format=md#source)󠁿

    ```php
    class HttplugFactory implements MessageFactory, StreamFactory, UriFactory
    {
        public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1'): RequestInterface
        {
            return new Request($method, $uri, $headers, $body, $protocolVersion);
        }
        public function createResponse($statusCode = 200, $reasonPhrase = null, array $headers = [], $body = null, $version = '1.1'): ResponseInterface
        {
            return new Response((int) $statusCode, $headers, $body, $version, $reasonPhrase);
        }
        public function createStream($body = null): StreamInterface
        {
            return Stream::create($body ?? '');
        }
        public function createUri($uri = ''): UriInterface
        {
            if ($uri instanceof UriInterface) {
                return $uri;
            }
            return new Uri($uri);
        }
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/php-ai-client/third-party/nyholm/psr7/factory/httplugfactory.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/php-ai-client/third-party/Nyholm/Psr7/Factory/HttplugFactory.php#L29)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/php-ai-client/third-party/Nyholm/Psr7/Factory/HttplugFactory.php#L29-L50)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwordpress-aiclientdependencies-nyholm-psr7-factory-httplugfactory%2F)
before being able to contribute a note or feedback.