folded/http

HTTP utilities for your web app.

0.1.2 2020-09-13 18:55 UTC

This package is auto-updated.

Last update: 2024-12-29 06:21:52 UTC


README

Packagist License Packagist PHP Version Support Packagist Version Unit Tests Maintainability

HTTP utilities for your web app.

Summary

Requirements

Installation

$ composer require folded/http

⬆️ Back to summary.

API

⬆️ Back to summary.

Information response

⬆️ Back to summary.

Continue

<?php

use Http\Information;

echo Information::CONTINUE; // 100

⬆️ Back to summary.

Switching protocols

<?php

use Http\Information;

echo Information::SWITCHING_PROTOCOLS; // 101

⬆️ Back to summary.

Processing

<?php

use Http\Information;

echo Information::PROCESSING; // 102

⬆️ Back to summary.

Early hints

<?php

use Http\Information;

echo Information::EARLY_HINTS; // 103

⬆️ Back to summary.

Success

<?php

use Http\Success;

echo Success::OK; // 200

⬆️ Back to summary.

Created

<?php

use Http\Success;

echo Success::CREATED; // 201

⬆️ Back to summary.

Accepted

<?php

use Http\Success;

echo Success::ACCEPTED; // 202

⬆️ Back to summary.

Non-authoritative information

<?php

use Http\Success;

echo Success::NON_AUTHORITATIVE_INFORMATION; // 203

⬆️ Back to summary.

No content

<?php

use Http\Success;

echo Success::NO_CONTENT; // 204

⬆️ Back to summary.

Reset content

<?php

use Http\Success;

echo Success::RESET_CONTENT; // 205

⬆️ Back to summary.

Partial content

<?php

use Http\Success;

echo Success::PARTIAL_CONTENT; // 206

⬆️ Back to summary.

Multi-status

<?php

use Http\Success;

echo Success::MULTI_STATUS; // 207

⬆️ Back to summary.

Already reported

<?php

use Http\Success;

echo Success::ALREADY_REPORTED; // 208

⬆️ Back to summary.

Instance-manipulations used

<?php

use Http\Success;

echo Success::IM_USED; // 226

⬆️ Back to summary.

Redirection

⬆️ Back to summary.

Multiple choices

<?php

use Http\Redirection;

echo Redirection::MULTIPLE_CHOICES; // 300

⬆️ Back to summary.

Moved permanently

<?php

use Http\Redirection;

echo Redirection::MOVED_PERMANENTLY; // 301

⬆️ Back to summary.

Found (moved temporarily)

<?php

use Http\Redirection;

echo Redirection::FOUND;                // 302
echo Redirection::MOVED_TEMPORARILY;    // 302

⬆️ Back to summary.

See other

<?php

use Http\Redirection;

echo Redirection::SEE_OTHER; // 303

⬆️ Back to summary.

Not modified

<?php

use Http\Redirection;

echo Redirection::NOT_MODIFIED; // 304

⬆️ Back to summary.

Use proxy

<?php

use Http\Redirection;

echo Redirection::USE_PROXY; // 305

⬆️ Back to summary.

Switch proxy

<?php

use Http\Redirection;

echo Redirection::SWITCH_PROXY; // 306

⬆️ Back to summary.

Temporary redirect

<?php

use Http\Redirection;

echo Redirection::TEMPORARY_REDIRECT; // 307

⬆️ Back to summary.

Permanent redirect

<?php

use Http\Redirection;

echo Redirection::PERMANENT_REDIRECT; // 308

⬆️ Back to summary.

Error

⬆️ Back to summary.

Bad request

<?php

use Http\Error;

echo Error::BAD_REQUEST; // 400

⬆️ Back to summary.

Unauthorized

<?php

use Http\Error;

echo Error::UNAUTHORIZED; // 401

⬆️ Back to summary.

Payment required

<?php

use Http\Error;

echo Error::PAYMENT_REQUIRED; // 402

⬆️ Back to summary.

Forbidden

<?php

use Http\Error;

echo Error::FORBIDDEN; // 403

⬆️ Back to summary.

Not found

<?php

use Http\Error;

echo Error::NOT_FOUND; // 404

⬆️ Back to summary.

Method not allowed

<?php

use Http\Error;

echo Error::METHOD_NOT_ALLOWED; // 405

⬆️ Back to summary.

Not acceptable

<?php

use Http\Error;

echo Error::NOT_ACCEPTABLE; // 406

⬆️ Back to summary.

Proxy authentication required

<?php

use Http\Error;

echo Error::PROXY_AUTHENTICATION_REQUIRED; // 407

⬆️ Back to summary.

Request timeout

<?php

use Http\Error;

echo Error::REQUEST_TIMEOUT; // 408

⬆️ Back to summary.

Conflict

<?php

use Http\Error;

echo Error::CONFLICT; // 409

⬆️ Back to summary.

Gone

<?php

use Http\Error;

echo Error::GONE; // 410

⬆️ Back to summary.

Length required

<?php

use Http\Error;

echo Error::LENGTH_REQUIRED; // 411

⬆️ Back to summary.

Precondition failed

<?php

use Http\Error;

echo Error::PRECONDITION_FAILED; // 412

⬆️ Back to summary.

Payload too large

<?php

use Http\Error;

echo Error::PAYLOAD_TOO_LARGE; // 413

⬆️ Back to summary.

URI too long

<?php

use Http\Error;

echo Error::URI_TOO_LONG; // 414

⬆️ Back to summary.

Unsupported media type

<?php

use Http\Error;

echo Error::UNSUPPORTED_MEDIA_TYPE; // 415

⬆️ Back to summary.

Range not satisfiable

<?php

use Http\Error;

echo Error::RANGE_NOT_SATISFIABLE; // 416

⬆️ Back to summary.

Expectation failed

<?php

use Http\Error;

echo Error::EXPECTATION_FAILED; // 417

⬆️ Back to summary.

I'm a teapot

<?php

use Http\Error;

echo Error::IM_A_TEAPOT; // 418

⬆️ Back to summary.

Misdirected request

<?php

use Http\Error;

echo Error::MISDIRECTED_REQUEST; // 419

⬆️ Back to summary.

Unprocessable entity

<?php

use Http\Error;

echo Error::UNPROCESSABLE_ENTITY; // 422

⬆️ Back to summary.

Locked

<?php

use Http\Error;

echo Error::LOCKED; // 423

⬆️ Back to summary.

Failed dependency

<?php

use Http\Error;

echo Error::FAILED_DEPENDENCY; // 424

⬆️ Back to summary.

Too early

<?php

use Http\Error;

echo Error::TOO_EARLY; // 425

⬆️ Back to summary.

Upgrade required

<?php

use Http\Error;

echo Error::UPGRADE_REQUIRED; // 426

⬆️ Back to summary.

Precondition required

<?php

use Http\Error;

echo Error::PRECONDITION_REQUIRED; // 428

⬆️ Back to summary.

Too many requests

<?php

use Http\Error;

echo Error::TOO_MANY_REQUESTS; // 429

⬆️ Back to summary.

Request header fields too large

<?php

use Http\Error;

echo Error::REQUEST_HEADER_FIELDS_TOO_LARGE; // 431

⬆️ Back to summary.

Unavailable for legal reasons

<?php

use Http\Error;

echo Error::UNAVAILABLE_FOR_LEGAL_REASONS; // 451

⬆️ Back to summary.

Server error

⬆️ Back to summary.

Internal server error

<?php

use Http\ServerError;

echo ServerError::INTERNAL_SERVER_ERROR; // 500

⬆️ Back to summary.

Not implemented

<?php

use Http\ServerError;

echo ServerError::NOT_IMPLEMENTED; // 501

⬆️ Back to summary.

Bad gateway

<?php

use Http\ServerError;

echo ServerError::BAD_GATEWAY; // 502

⬆️ Back to summary.

Service unavailable

<?php

use Http\ServerError;

echo ServerError::SERVICE_UNAVAILABLE; // 503

⬆️ Back to summary.

Gateway timeout

<?php

use Http\ServerError;

echo ServerError::GATEWAY_TIMEOUT; // 504

⬆️ Back to summary.

Http version not supported

<?php

use Http\ServerError;

echo ServerError::HTTP_VERSION_NOT_SUPPORTED; // 505

⬆️ Back to summary.

Variant also negotiates

<?php

use Http\ServerError;

echo ServerError::VARIANT_ALSO_NEGOTIATES; // 506

⬆️ Back to summary.

Insufficient storage

<?php

use Http\ServerError;

echo ServerError::INSUFFICIENT_STORAGE; // 507

⬆️ Back to summary.

Loop detected

<?php

use Http\ServerError;

echo ServerError::LOOP_DETECTED; // 508

⬆️ Back to summary.

Not extended

<?php

use Http\ServerError;

echo ServerError::NOT_EXTENDED; // 510

⬆️ Back to summary.

Network authentication required

<?php

use Http\ServerError;

echo ServerError::NETWORK_AUTHENTICATION_REQUIRED; // 511

⬆️ Back to summary.

Changelog

See CHANGELOG.md.

⬆️ Back to summary.

Contributing

See CONTRIBUTING.md.

⬆️ Back to summary.

License

See LICENSE.

⬆️ Back to summary.