{"id":16423341,"url":"https://github.com/robertmain/communique","last_synced_at":"2026-02-08T17:33:17.022Z","repository":{"id":36541173,"uuid":"40847001","full_name":"robertmain/communique","owner":"robertmain","description":"A flexible pluggable REST client","archived":false,"fork":false,"pushed_at":"2018-01-08T21:15:18.000Z","size":828,"stargazers_count":0,"open_issues_count":8,"forks_count":3,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-07-23T09:52:52.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"socketio/socket.io","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertmain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-16T23:13:44.000Z","updated_at":"2018-01-08T21:14:48.000Z","dependencies_parsed_at":"2022-09-08T17:32:27.155Z","dependency_job_id":null,"html_url":"https://github.com/robertmain/communique","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/robertmain/communique","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmain%2Fcommunique","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmain%2Fcommunique/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmain%2Fcommunique/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmain%2Fcommunique/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertmain","download_url":"https://codeload.github.com/robertmain/communique/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmain%2Fcommunique/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29238366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T14:18:14.570Z","status":"ssl_error","status_checked_at":"2026-02-08T14:18:14.071Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-11T07:39:31.620Z","updated_at":"2026-02-08T17:33:17.006Z","avatar_url":"https://github.com/robertmain.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Communique\n\n[![Join the chat at https://gitter.im/robertmain/communique](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/robertmain/communique?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![Build Status](https://travis-ci.org/robertmain/communique.svg?branch=master)](https://travis-ci.org/robertmain/communique) \n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/robertmain/communique/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/robertmain/communique/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/robertmain/communique/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/robertmain/communique/?branch=master)  \n\n[![Latest Stable Version](https://poser.pugx.org/robertmain/communique/v/stable)](https://packagist.org/packages/robertmain/communique)\n[![Total Downloads](https://poser.pugx.org/robertmain/communique/downloads)](https://packagist.org/packages/robertmain/communique)\n[![Latest Unstable Version](https://poser.pugx.org/robertmain/communique/v/unstable)](https://packagist.org/packages/robertmain/communique)\n[![License](https://poser.pugx.org/robertmain/communique/license)](https://packagist.org/packages/robertmain/communique)\n[![Monthly Downloads](https://poser.pugx.org/robertmain/communique/d/monthly)](https://packagist.org/packages/robertmain/communique)\n[![Daily Downloads](https://poser.pugx.org/robertmain/communique/d/daily)](https://packagist.org/packages/robertmain/communique)\n\n## What is it?\n\nA flexible pluggable REST client using middleware. The aim of this project is to provide a REST client that is flexible enough to permit the modification of the request and response using request and response interceptors(conceptually similar to AngularJS, although implemented somewhat differently).\n\n## Usage\n\n### Typical Usage\n\nYou can make a request with the REST library using the code below. It is worth noting, the get, put, post, delete etc. methods \ndo not return the raw response payload, but an encapsulation object of type [\\Communique\\RESTClientResponse](http://robertmain.github.io/communique/classes/Communique.RESTClientResponse.html). This object contains\n\n1. The HTTP status code (200, 201, 404, 500 etc.)\n1. The response payload (the response body from the server)\n1. The server headers (any headers that the server returned with the payload, these are often useful for cache control).\n\nYou can find more information from the [\\Communique\\RESTClientResponse](http://robertmain.github.io/communique/classes/Communique.RESTClientResponse.html) documentation\n\n```php\n\u003c?php\n    $rest = new \\Communique\\Communique('http://api.company.com/');\n    $response = $rest-\u003eget('users/1'); //Contains information about user number 1\n    // Since $response is actually a RESTClientResponse object (rather than the raw response payload), we can get\n    // properties of the request like so:\n    echo $response-\u003estatus; //This will be the HTTP status code\n    // If we want the raw request payload we do this:\n    echo $response-\u003epayload;\n    // Headers can be retrieved like so:\n    echo $response-\u003egetHeader('header_key');\n?\u003e\n```\n\n### Request Interceptors\n\nWhilst the above example is useful for making simple requests and returning the result from the API,\nyou may wish to have a little more control over the request. Communique provides a method to do this using Interceptors. \nAn interceptor is a class with request and response methods. The request method of each interceptor is called on each request\nand each the response interceptor method is called on each response. This allows the complex modification of requests juts before\nthey are sent and just after they are retured. This allows for things like JSON parsing, OAuth request signing or caching.\nInterceptors are executed in the order in which they are provided.\nIf you wish to add an interceptor, you may do so by passing an array with an instance of your interceptor as the second constructor\nargumment to Communique. Interceptors should implement the [\\Communique\\Interceptor](http://robertmain.github.io/communique/classes/Communique.Interceptor.html) interface\n\n```php\n\u003c?php\n     $rest = new \\Communique\\Communique('http://api.company.com/', array(new JSONParser(), new OAuth()));\n     // Use the library as before\n?\u003e\n```\n\n### Custom HTTP Client\n\nThis library ships out of the box with a cURL implementation, however if you wish to provide your own you may do so\nusing the third constructor argument as follows:\n\n```php\n\u003c?php\n    $rest = new \\Communique\\Communique('http://api.company.com/', array(new JSONParser(), new OAuth()), new CustomHTTPClient());\n    // Use the library as before\n?\u003e\n```\n\n## Licensing\n\nLicensed under the GPL - please see the file called LICENSE for more info.\n\n## Contacts\n\n- If you want to submit a bug report or issue, please do so using the issue tracker on GitHub\n\n## Documentation\n\nThe documentation can be found [here](http://robertmain.github.io/communique)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertmain%2Fcommunique","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertmain%2Fcommunique","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertmain%2Fcommunique/lists"}