All Projects → ergebnis → http-method

ergebnis / http-method

Licence: MIT license
🍇 Provides constants for HTTP request methods.

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to http-method

Use Http
🐶 React hook for making isomorphic http requests
Stars: ✭ 2,066 (+2389.16%)
Mutual labels:  request
Goz
A fantastic HTTP request libarary used in Golang.
Stars: ✭ 187 (+125.3%)
Mutual labels:  request
Fire
🔥A delightful HTTP/HTTPS networking framework for iOS/macOS/watchOS/tvOS platforms written in Swift.
Stars: ✭ 243 (+192.77%)
Mutual labels:  request
Wechat Request
🚀⚡️基于Promise实现微信小程序http请求,轻便,小巧,api友好,功能丰富
Stars: ✭ 156 (+87.95%)
Mutual labels:  request
Insta Mass Account Creator
User Friendly - Instagram Auto Account Creation Bot 🤖
Stars: ✭ 173 (+108.43%)
Mutual labels:  request
Cacheable Request
Wrap native HTTP requests with RFC compliant cache support
Stars: ✭ 218 (+162.65%)
Mutual labels:  request
Guzzle Advanced Throttle
A Guzzle middleware that can throttle requests according to (multiple) defined rules. It is also possible to define a caching strategy, e.g. get the response from cache when the rate limit is exceeded or always get a cached value to spare your rate limits. Using wildcards in host names is also supported.
Stars: ✭ 120 (+44.58%)
Mutual labels:  request
chronosjs
JS Channels (Events / Commands / Reqest-Response / Courier) Mechanism
Stars: ✭ 35 (-57.83%)
Mutual labels:  request
Bodyclose
Analyzer: checks whether HTTP response body is closed and a re-use of TCP connection is not blocked.
Stars: ✭ 181 (+118.07%)
Mutual labels:  request
Popsicle
Simple HTTP requests for node and the browser
Stars: ✭ 238 (+186.75%)
Mutual labels:  request
Github Ranking
🔍GitHub不同语言热门项目排行,Vue.js做页面展示
Stars: ✭ 160 (+92.77%)
Mutual labels:  request
Examples
Examples of Mock Service Worker usage with various frameworks and libraries.
Stars: ✭ 163 (+96.39%)
Mutual labels:  request
Luch Request
luch-request 是一个基于Promise 开发的uni-app跨平台、项目级别的请求库,它有更小的体积,易用的api,方便简单的自定义能力。
Stars: ✭ 219 (+163.86%)
Mutual labels:  request
Holen
Declarative fetch for React
Stars: ✭ 152 (+83.13%)
Mutual labels:  request
AxleJS
Fetch, supercharged.
Stars: ✭ 28 (-66.27%)
Mutual labels:  request
Baseokhttpv3
🔥OkHttp的二次封装库,提供各种快速使用方法以及更为方便的扩展功能。提供更高效的Json请求和解析工具以及文件上传下载封装,HTTPS和Cookie操作也更得心应手。
Stars: ✭ 121 (+45.78%)
Mutual labels:  request
Wretch
A tiny wrapper built around fetch with an intuitive syntax. 🍬
Stars: ✭ 2,285 (+2653.01%)
Mutual labels:  request
liu
💫 Boshiamy Input Method in macOS 嘸蝦米輸入法
Stars: ✭ 39 (-53.01%)
Mutual labels:  method
reqres
Powerful classes for http requests and responses
Stars: ✭ 36 (-56.63%)
Mutual labels:  request
Wx Promise Request
解决微信小程序 wx.request 请求的并发数限制、不支持异步问题
Stars: ✭ 226 (+172.29%)
Mutual labels:  request

http-method

Integrate Merge Prune Release Renew Triage

Type Coverage

Latest Stable Version Total Downloads

Provides constants for HTTP request methods, inspired by teapot/status-code.

Motivation

Several PHP frameworks and libraries come with their own abstractions of HTTP request and response objects. Some of them provide constants for

  • HTTP request method names
  • HTTP response status codes

so that a developer can refer to these by using named constants instead of magic numbers or magic strings.

Here are a few examples of HTTP request abstractions which provide constants for HTTP request methods:

Here are a few examples of HTTP response abstractions which provide constants for HTTP response status codes:

Here are a few examples of interfaces providing constants for HTTP request methods and HTTP response status codes:

However, a developer might use an abstraction that either does not provide any constants at all, or only provides a subset of the constants required for the specific case.

The excellent library teapot/status-code already provides HTTP status codes that are standardized by RFCs, as well as a range of vendor-specific HTTP status codes.

In a similar fashion, this library here aims to provide a collection of interfaces with constants for HTTP request methods that are standardized by RFCs, as well as additional vendor-specific HTTP request methods.

Installation

Run

composer require ergebnis/http-method

Usage

The interface Ergebnis\Http\Method provides constants for all of the HTTP request methods that are standardized by

namely

  • CONNECT
  • DELETE
  • GET
  • HEAD
  • OPTIONS
  • PATCH
  • POST
  • PUT
  • TRACE

The interface Ergebnis\Http\Method\WebDav provides constants for all of the HTTP request methods that are standardized by

namely

  • ACL
  • BIND
  • CONNECT
  • COPY
  • DELETE
  • GET
  • HEAD
  • LOCK
  • MKCALENDAR
  • MKCOL
  • MKREDIRECTREF
  • MOVE
  • OPTIONS
  • ORDERPATCH
  • PATCH
  • POST
  • PROPFIND
  • PROPPATCH
  • PUT
  • REBIND
  • SEARCH
  • TRACE
  • UNBIND
  • UNLOCK
  • UPDATEREDIRECTREF

The interface Ergebnis\Http\Method\Vendor\SquidCache provides constants for a suggest HTTP request method used for purging items from the cache, namely

  • PURGE

The interface Ergebnis\Http\Method\Vendor\VarnishCache provides constants for a suggest HTTP request method used for invalidating and purging items from the cache, namely

  • BAN
  • PURGE

To use these constants, import the interfaces and refer to the constants instead of using magic strings:

<?php

use Ergebnis\Http\Method;
use Psr\Http\Client;
use Psr\Http\Message;

/** @var Message\RequestFactoryInterface $requestFactory */
$request = $requestFactory->create(
    Method::GET,
    'https://localheinz.com/blog'
);

/** @var Client\ClientInterface $httpClient */
$httpClient->sendRequest($request);

💡 If you are aware of any other - either standardized or vendor-specific - HTTP methods that are used in the wild, please let me know!

Changelog

Please have a look at CHANGELOG.md.

Contributing

Please have a look at CONTRIBUTING.md.

Code of Conduct

Please have a look at CODE_OF_CONDUCT.md.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.

Curious what I am building?

📬 Subscribe to my list, and I will occasionally send you an email to let you know what I am working on.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].