Skip to main content
Github

Experimental HTTP features

HTTP method override

GET and POST are the only HTTP methods supported by HTML forms in web browsers. In such situations, you can simulate other methods using Inphinit\Experimental\Http\Method::override(). See the example below:

use Inphinit\Experimental\Http\Method; Method::override(); // E.g., http://localhost/form $app->action('GET', '/form', function () { echo '<form action="/status" method="POST">'; // Override echo '<input type="hidde" name="_method" value="PUT">'; echo '<input type="text" name="message"><br>'; echo '<button>Update status</button>'; echo '</form>'; }); // E.g., http://localhost/status $app->action('PUT', '/status', function () { echo 'Status updated!<br>'; echo '<a href="/status?_method=DELETE">clear<a>'; }); // E.g., http://localhost/status $app->action('DELETE', '/status', function () { echo 'Status cleared!'; });

Fields and Querystring

Fields (POST) and querystrings (GET) supported are _method and _HttpMethod

Headers

Supported headers: x-http-method, x-http-method-override and x-method-override. Example:

POST /status HTTP/1.1 x-http-method: PUT foo=1&bar=2&baz=3