Download the PHP package jdz/http without Composer

On this page you can find all versions of the php package jdz/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 http

JDZ HTTP Status

Some useful utilities for HTTP responses (codes).

Installation

To install this library, use Composer:

Versions

V1: Provides three separate enums: HttpStatusCode, HttpStatusText, and HttpStatusAlias.

V2: Added a single combined enum: HttpStatus with methods to get code, text, and alias.

Both approaches are valid and produce the same results! The three separate enums (HttpStatusCode, HttpStatusText, HttpStatusAlias) do exactly the same thing as HttpStatus, but HttpStatus combines them into a single, more convenient API with built-in getText() and getAlias() methods.

Use HttpStatus when:

Use Separate Enums when:

Usage

HttpStatus

The HttpStatus enum provides numeric values for HTTP status codes [https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml](as registered by IANA).

HttpStatusCode

The HttpStatusCode enum provides numeric values for HTTP status codes.

HttpStatusText

The HttpStatusText enum provides text values for HTTP status codes.

HttpStatusAlias

The HttpStatusAlias enum provides alias values for HTTP status codes.

Converting Between Enums

You can convert between the different enums using the provided static methods.

Examples

This directory contains examples demonstrating how to use the JDZ HTTP Utils library. You can run any example using PHP from the command line:

1. HttpStatus enum (v 2.0) (1-basic-usage.php)

Shows how to use the HttpStatus enum (combined approach) to get status codes, text descriptions, and aliases all from one enum.

Key Points:

2. Separate Enums (v 1.0) (2-separate-enums.php)

Demonstrates using HttpStatusCode, HttpStatusText, and HttpStatusAlias separately to achieve the same results.

Key Points:

3. Comparison (3-comparison.php)

Side-by-side comparison showing that both approaches (HttpStatus vs. separate enums) produce identical results.

4. API Response (4-api-response.php)

Real-world example showing how to use both approaches in API response classes.

Key Points:

5. Dynamic Lookup (5-dynamic-lookup.php)

Shows how to dynamically look up status codes using the fromName() method in both approaches.

Key Points:

6. All Categories (6-all-categories.php)

Comprehensive example working with all HTTP status categories (1xx through 5xx).

7. Using fromAlias() (7-from-alias.php)

Demonstrates the fromAlias() method for retrieving status codes by their alias string.

Testing

To run the tests, use PHPUnit:

License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of http with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
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 jdz/http contains the following files

Loading the files please wait ...