{"id":22656880,"url":"https://github.com/libreworks/caridea-http","last_synced_at":"2025-10-17T03:57:45.873Z","repository":{"id":33180806,"uuid":"36822311","full_name":"libreworks/caridea-http","owner":"libreworks","description":":fried_shrimp: Caridea is a miniscule PHP application library. This is a shrimpy HTTP utility library.","archived":false,"fork":false,"pushed_at":"2018-01-14T17:40:01.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-04T04:16:08.844Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libreworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-03T18:25:47.000Z","updated_at":"2016-11-17T19:52:11.000Z","dependencies_parsed_at":"2022-09-12T19:01:51.730Z","dependency_job_id":null,"html_url":"https://github.com/libreworks/caridea-http","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/libreworks/caridea-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libreworks","download_url":"https://codeload.github.com/libreworks/caridea-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279280326,"owners_count":26139273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T10:16:47.238Z","updated_at":"2025-10-17T03:57:45.802Z","avatar_url":"https://github.com/libreworks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# caridea-http\nCaridea is a miniscule PHP application library. This shrimpy fellow is what you'd use when you just want some helping hands and not a full-blown framework.\n\n![](http://libreworks.com/caridea-100.png)\n\nThis is its HTTP component. It includes small utilities for working with [PSR-7](http://www.php-fig.org/psr/psr-7/) HTTP requests and responses, including:\n\n* An implementation of RFC 7807, \"[Problem Details for HTTP APIs](https://tools.ietf.org/html/rfc7807)\".\n* A utility to parse common pagination parameters from the request\n* A utility to correctly parse query strings with multiple parameters having the same name\n* A utility to determine a client's preferred accepted MIME type\n\n[![Packagist](https://img.shields.io/packagist/v/caridea/http.svg)](https://packagist.org/packages/caridea/http)\n[![Build Status](https://travis-ci.org/libreworks/caridea-http.svg)](https://travis-ci.org/libreworks/caridea-http)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/libreworks/caridea-http/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/libreworks/caridea-http/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/libreworks/caridea-http/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/libreworks/caridea-http/?branch=master)\n[![Documentation Status](http://readthedocs.org/projects/caridea-http/badge/?version=latest)](http://caridea-http.readthedocs.io/en/latest/?badge=latest)\n\n## Installation\n\nYou can install this library using Composer:\n\n```console\n$ composer require caridea/http\n```\n\n* The master branch (version 3.x) of this project requires PHP 7.1 and depends on `psr/http-message`.\n* Version 2.x of this project requires PHP 7.0 and depends on `psr/http-message`.\n* Version 1.x of this project requires PHP 5.5 and depends on `psr/http-message`.\n\n## Compliance\n\nReleases of this library will conform to [Semantic Versioning](http://semver.org).\n\nOur code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), and [PSR-4](http://www.php-fig.org/psr/psr-4/). If you find any issues related to standards compliance, please send a pull request!\n\n## Documentation\n\n* Head over to [Read the Docs](http://caridea-http.readthedocs.io/en/latest/)\n\n## Examples\n\nJust a few quick examples.\n\n### Problem Details\n\nWe included an implementation of RFC 7807 that you can serialize to JSON or\nappend to a PSR-7 HTTP Response.\n\n```php\nuse Caridea\\Http\\ProblemDetails;\nuse Zend\\Diactoros\\Uri;\n\n$problem = new ProblemDetails(\n    new Uri('http://example.com/problem/oops'),  // type\n    'A weird thing happened',                    // title\n    500,                                         // status\n    'It looks like the server has goofed again', // detail\n    new Uri('http://example.com/problems/1f9a'), // instance\n    [                                            // extensions\n        'server' =\u003e 'workerbee01.example.com',\n        'auth' =\u003e 'foobar'\n    ]\n);\necho json_encode($problem);\n\n```\n\n### Pagination Factory\n\n```php\nuse Zend\\Diactoros\\ServerRequestFactory;\n\n$request = ServerRequestFactory::fromGlobals(\n    $_SERVER,\n    \\Caridea\\Http\\QueryParams::getFromServer(), // instead of $_GET\n);\n\n$factory = new \\Caridea\\Http\\PaginationFactory();\n\n// say the Query was ?count=25\u0026startIndex=1\u0026sort=%2Bfoo\u0026sort-bar\n// or maybe          ?count=25\u0026start=0\u0026sort=%2Bfoo,-bar\n// or one of many other formats for this type of pagination settingns\n$pagination = $factory-\u003ecreate($request, 'sort');\n$pagination-\u003egetMax();    // 25\n$pagination-\u003egetOffset(); // 0\n$pagination-\u003egetOrder();  // ['foo' =\u003e true, 'bar' =\u003e false]\n```\n\n### Accept Types\n\n```php\n// say the HTTP_ACCEPT field is text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n$types = new \\Caridea\\Http\\AcceptTypes($_SERVER);\n$types-\u003epreferred(['application/xml', 'application/json']); // returns application/xml\n```\n\n### Helper Traits\n\nTwo traits are now available, `JsonHelper` and `MessageHelper`. These can be used by controller classes or dispatcher middleware.\n\n## Third-Party\n\nThe traits `JsonHelper` and `MessageHelper` (as well as their unit tests) were ported to PHP from the Labrys library under a compatible Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibreworks%2Fcaridea-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibreworks%2Fcaridea-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibreworks%2Fcaridea-http/lists"}