GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pear/HTTP2: Miscellaneous HTTP utilities

BranchesTags
Open more actions menu

Latest commit

 

History

126 Commits
126 Commits

Folders and files

NameName
Last commit message
Last commit date
HTTP2
HTTP2
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
HTTP2.php
HTTP2.php
 
 
LICENSE
LICENSE
 
 
README.rst
README.rst
 
 
composer.json
composer.json
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

HTTP2 - Miscellaneous HTTP utilities

Static methods for doing miscellaneous HTTP related stuff like date formatting, language negotiation or HTTP redirection.

Features

  • Language negotiation
  • MIME type negotiation
  • Charset negotiation
  • Send HEAD requests to URLs
  • Make URLs absolute
  • Parse HTTP Link: header values (RFC 5988)

Installation

$ composer require pear/http2

Usage

Language negotiation

Quality factors in the Accept-Language: header are supported, e.g.:

Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8

Code:

<?php
$http = new HTTP2();
$langs = array(
    'en'    => 'locales/en',
    'en-US' => 'locales/en',
    'en-UK' => 'locales/en',
    'de'    => 'locales/de',
    'de-DE' => 'locales/de',
    'de-AT' => 'locales/de',
);
$neg = $http->negotiateLanguage($langs);
$dir = $langs[$neg];
?>

Charset negotiation

<?php
$http = new HTTP2();
$charsets = array(
    'UTF-8',
    'ISO-8859-1',
);
$charset = $http->negotiateCharset($charsets);
?>

MIME type negotiation

<?php
$http = new HTTP2();
$contentType = array(
    'application/xhtml+xml',
    'application/xml',
    'text/html',
    'text/plain',
);
$mime = $http->negotiateMimeType($contentType);
?>

Links

Homepage
http://pear.php.net/package/HTTP2
Bug tracker
http://pear.php.net/bugs/search.php?cmd=display&package_name[]=HTTP2
Documentation
http://pear.php.net/package/HTTP2/docs
Unit test status

https://travis-ci.org/pear/HTTP2

https://travis-ci.org/pear/HTTP2.svg?branch=master
Packagist
https://packagist.org/packages/pear/http2

About

Miscellaneous HTTP utilities

pear.php.net/HTTP2

Resources

Readme
License
Activity
Custom properties

Stars

12 stars

Watchers

5 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.