Giter Site home page Giter Site logo

asispts / http-accept Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 96 KB

PHP Parser to deal with HTTP Accept, Accept-Language, Accept-Encoding, and Content-Type headers

License: Apache License 2.0

PHP 100.00%
accept accept-encoding accept-language content-type http-header-parser http-headers

http-accept's Issues

Extract basic HTTP header parsing functionality

I need to parse the Content-Type header with parameters. Using the Accept parser works fine, but it feels a bit wrong, since Content-Type has only a subset of the semantics (can only have one, and no q parameter or scoring).

I wonder if you'd be open to a slight refactor to extract the basic parsing functionality into a separate class perhaps, and build the more specialised Accept parsing on top of that?

Parse media type parameters

Currently parameters are not parsed into key/value pairs, they're just stored as an array of strings:

$mediaList = (new AcceptParser())->parse('*/*; one=value; two=value');
print_r($mediaList->preferedMedia(0)->parameters());
Array
(
    [0] => one=value,
    [1] => two=value
)

Is there any reason they're not parsed into key/value pairs, ie:

Array
(
    [one] => value,
    [two] => value
)

Replace coding standard

Package pattisahusiwa/coding-standard is abandoned, you should avoid using it. Use asispts/ptscs instead.

Package pattisahusiwa/coding-standard has been replaced by asispts/ptscs. However, asispts/ptscs requires PHP version 7.2 or higher.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.