Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
GH Pages: update other docs for Requests 959/merge
  • Loading branch information
github-actions[bot] authored Oct 27, 2025
commit e15c06e9bd5e2917e00a115ab6704817378cc39c
2 changes: 1 addition & 1 deletion docs/goals.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Goals

No matter what you have installed on your system, you should be able to run
Requests. We use cURL if it's available, and fallback to sockets otherwise.
We require only a baseline of PHP 5.6, leaving the choice of PHP minimum
We require only a baseline of PHP 5.6.20, leaving the choice of PHP minimum
requirement fully in your hands, and giving you the ability to support many
more hosts.

Expand Down
16 changes: 10 additions & 6 deletions docs/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Available Hooks

* **`curl.before_send`**

Set cURL options just before the request is actually sent via `curl_exec()`.
Set cURL options before the request is actually sent via `curl_exec()`.

Parameters: `cURL resource|CurlHandle &$handle`

Expand All @@ -91,12 +91,14 @@ Available Hooks

Alter the raw HTTP response before returning for parsing.

Parameters: `string &$headers`, `[array &$info]`
Parameters: `string &$headers`, `array &$info`

The optional `$info` parameter contains the associated array as defined in
The `$info` parameter contains the associated array as defined in
the return value for [curl_getinfo()](https://www.php.net/curl-getinfo#refsect1-function.curl-getinfo-returnvalues).

This optional parameter will be present when a blocking request was made (`$options['blocking' = true`) and will not be present when a non-blocking request was made (`$options['blocking' = false`). The callback signature needs to be adapted accordingly.
When a non-blocking request was made (`$options['blocking'] = false`), both the `$headers` string as well as the `$info` array will be empty.

Prior to Requests 2.1.0, the `$info` parameter was omitted for non-blocking requests.

* **`curl.before_multi_add`**

Expand Down Expand Up @@ -154,12 +156,14 @@ This optional parameter will be present when a blocking request was made (`$opti

Alter the raw HTTP response before returning for parsing.

Parameters: `string &$headers`, `[array &$info]`
Parameters: `string &$headers`, `array &$info`

The optional `$info` parameter contains the associated array as defined
in the return value for [stream_get_meta_data()](https://www.php.net/stream-get-meta-data#refsect1-function.stream-get-meta-data-returnvalues).

This optional parameter will be present when a blocking request was made (`$options['blocking' = true`) and will not be present when a non-blocking request was made (`$options['blocking' = false`). The callback signature needs to be adapted accordingly.
When a non-blocking request was made (`$options['blocking'] = false`), both the `$headers` string as well as the `$info` array will be empty.

Prior to Requests 2.1.0, the `$info` parameter was omitted for non-blocking requests.


Registering Hooks
Expand Down
31 changes: 6 additions & 25 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Requests is a HTTP library written in PHP, for human beings. It is roughly
based on the API from the excellent [Requests Python
library](http://python-requests.org/). Requests is [ISC
Licensed](https://github.com/WordPress/Requests/blob/stable/LICENSE) (similar to
the new BSD license) and has no dependencies, except for PHP 5.6+.
the new BSD license) and has no dependencies, except for PHP 5.6.20+.

Despite PHP's use as a language for the web, its tools for sending HTTP requests
are severely lacking. cURL has an
Expand Down Expand Up @@ -131,25 +131,15 @@ issue](https://github.com/WordPress/Requests/issues/new)!
[prose-based documentation]: {{ '/docs/' | prepend: site.baseurl }}
[request_method]: https://requests.ryanmccue.info/api-2.x/classes/WpOrg-Requests-Requests.html#method_request

Testing
-------

Test Coverage
-------------

Requests strives to have 100% code-coverage of the library with an extensive
set of tests. We're not quite there yet, but [we're getting close][codecov].

[codecov]: https://codecov.io/github/WordPress/Requests/

To run the test suite, first check that you have the [PHP
JSON extension ](https://www.php.net/book.json) enabled. Then
simply:
```bash
$ phpunit
```

If you'd like to run a single set of tests, specify just the name:
```bash
$ phpunit Transport/cURL
```

Requests and PSR-7/PSR-18
-------------------------
Expand All @@ -172,15 +162,6 @@ If you are interested in a PSR-7/PSR-18 compatible version of Requests, we highl
Contribute
----------

1. Check for open issues or open a new issue for a feature request or a bug.
2. Fork [the repository][] on Github to start making your changes to the
`develop` branch (or branch off of it).
3. Write one or more tests which show that the bug was fixed or that the feature works as expected.
4. Send in a pull request.

If you have questions while working on your contribution and you use Slack, there is
a [#core-http-api] channel available in the [WordPress Slack] in which contributions can be discussed.
Contributions to this library are very welcome. Please read the [Contributing guidelines][] to get started.

[the repository]: https://github.com/WordPress/Requests
[#core-http-api]: https://wordpress.slack.com/archives/C02BBE29V42
[WordPress Slack]: https://make.wordpress.org/chat/
[Contributing guidelines]: https://github.com/WordPress/Requests/blob/develop/.github/CONTRIBUTING.html