Download the PHP package ctw/ctw-http without Composer

On this page you can find all versions of the php package ctw/ctw-http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ctw-http

Package "ctw/ctw-http"

Latest Stable Version GitHub Actions

Utility classes, constants, and typed exceptions for PSR-7 HTTP operations, providing a complete HTTP status code registry with metadata and throwable exceptions for all 4xx/5xx status codes.

Introduction

Why This Library Exists

Working with HTTP in PHP often involves scattered magic numbers, inconsistent error handling, and repetitive exception creation. The PSR-7 standard defines message interfaces but doesn't provide status code constants, metadata, or exception types.

This library provides a complete HTTP toolkit:

Problems This Library Solves

  1. Magic numbers: Code uses 404 instead of readable STATUS_NOT_FOUND
  2. Inconsistent exceptions: Each project invents its own HTTP exception classes
  3. Missing metadata: Status codes lack human-readable descriptions
  4. Catch-all handling: No way to catch only client errors vs. server errors
  5. Documentation gaps: Developers must look up status code meanings externally

Where to Use This Library

Design Goals

  1. PSR-7 aligned: Implements Fig\Http\Message\StatusCodeInterface
  2. Complete coverage: All standard HTTP status codes (1xx through 5xx)
  3. Rich metadata: Name, phrase, and documentation URL for each status
  4. Exception hierarchy: Abstract base classes for client (4xx) and server (5xx) errors
  5. Type-safe: Full strict types and interface contracts

Requirements

Installation

Install by adding the package as a Composer requirement:

Usage Examples

HTTP Status Metadata

Retrieve complete metadata for any status code:

Throwing HTTP Exceptions

Each 4xx and 5xx status code has a dedicated exception class:

Catching Exceptions by Category

The exception hierarchy allows catching by error category:

Exception Hierarchy

HTTP Method Constants

HTTP Status Constants

Available Exception Classes

Status Exception Class
400 BadRequestException
401 UnauthorizedException
402 PaymentRequiredException
403 ForbiddenException
404 NotFoundException
405 MethodNotAllowedException
406 NotAcceptableException
407 ProxyAuthenticationRequiredException
408 RequestTimeoutException
409 ConflictException
410 GoneException
411 LengthRequiredException
412 PreconditionFailedException
413 PayloadTooLargeException
414 RequestUriTooLongException
415 UnsupportedMediaTypeException
416 RangeNotSatisfiableException
417 ExpectationFailedException
418 ImATeapotException
421 MisdirectedRequestException
422 UnprocessableEntityException
423 LockedException
424 FailedDependencyException
425 TooEarlyException
426 UpgradeRequiredException
428 PreconditionRequiredException
429 TooManyRequestsException
431 RequestHeaderFieldsTooLargeException
451 UnavailableForLegalReasonsException
500 InternalServerErrorException
501 NotImplementedException
502 BadGatewayException
503 ServiceUnavailableException
504 GatewayTimeoutException
505 VersionNotSupportedException
506 VariantAlsoNegotiatesException
507 InsufficientStorageException
508 LoopDetectedException
510 NotExtendedException
511 NetworkAuthenticationRequiredException

All versions of ctw-http with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
fig/http-message-util Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ctw/ctw-http contains the following files

Loading the files please wait ...