{"id":13721043,"url":"https://github.com/sendgrid/php-http-client","last_synced_at":"2026-02-16T08:07:48.109Z","repository":{"id":5966171,"uuid":"52621304","full_name":"sendgrid/php-http-client","owner":"sendgrid","description":"SendGrid's PHP HTTP Client for calling APIs","archived":false,"fork":false,"pushed_at":"2024-01-24T12:33:20.000Z","size":415,"stargazers_count":125,"open_issues_count":5,"forks_count":66,"subscribers_count":163,"default_branch":"main","last_synced_at":"2024-09-08T12:11:00.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sendgrid.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sendgrid.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-02-26T17:34:36.000Z","updated_at":"2024-08-09T16:39:30.000Z","dependencies_parsed_at":"2023-11-21T06:40:47.034Z","dependency_job_id":null,"html_url":"https://github.com/sendgrid/php-http-client","commit_stats":{"total_commits":256,"total_committers":59,"mean_commits":4.338983050847458,"dds":0.76953125,"last_synced_commit":"a93d5eb0db9accbcc9de84ba801c7cb88a248718"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fphp-http-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fphp-http-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fphp-http-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fphp-http-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sendgrid","download_url":"https://codeload.github.com/sendgrid/php-http-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224604727,"owners_count":17339192,"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","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-08-03T01:01:11.676Z","updated_at":"2026-02-16T08:07:43.085Z","avatar_url":"https://github.com/sendgrid.png","language":"PHP","readme":"![SendGrid Logo](twilio_sendgrid_logo.png)\n\n[![Tests](https://github.com/sendgrid/php-http-client/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/php-http-client/actions/workflows/test-and-deploy.yml)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/sendgrid/php-http-client.svg?style=flat-square)](https://packagist.org/packages/sendgrid/php-http-client)\n[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social\u0026label=Follow)](https://twitter.com/sendgrid)\n[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/php-http-client.svg)](https://github.com/sendgrid/php-http-client/graphs/contributors)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n**Quickly and easily access any RESTful or RESTful-like API.**\n\nIf you are looking for the SendGrid API client library, please see [this repo](https://github.com/sendgrid/sendgrid-php).\n\n# Announcements\nAll updates to this library are documented in our [CHANGELOG](CHANGELOG.md).\n\n# Table of Contents\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Usage](#usage)\n- [How to Contribute](#contribute)\n- [Thanks](#thanks)\n- [About](#about)\n- [Support](#support)\n- [License](#license)\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n# Installation\n\n## Prerequisites\n\n- PHP version 7.3+\n\n## Install with Composer\n\nAdd php-http-client to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.\n\n```json\n{\n  \"require\": {\n    \"sendgrid/php-http-client\": \"^4.1.3\"\n  }\n}\n```\n\nThen at the top of your PHP script require the autoloader:\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n```\n\nThen from the command line:\n\n```bash\ncomposer install\n```\n\n## Install without Composer\n\nYou should create a `lib` directory in the directory of your application and clone to `lib` repositories [php-http-client](https://github.com/sendgrid/php-http-client.git) and [sendgrid-php](https://github.com/sendgrid/sendgrid-php.git):\n\n```\n$ cd /path/to/your/app\n$ mkdir lib\n$ cd lib\n$ git clone https://github.com/sendgrid/php-http-client.git\n```\n\nIn the next step you should create `loader.php`:\n\n```\n$ cd /path/to/your/app\n$ touch loader.php\n```\n\nAnd add the code below to the `loader.php`:\n\n```php\n\u003c?php\n\nrequire_once __DIR__ . '/lib/php-http-client/lib/Client.php';\nrequire_once __DIR__ . '/lib/php-http-client/lib/Response.php';\n```\n\nAfter it you can use the `php-http-client` library in your project:\n\n```php\n\u003c?php\n\ninclude __DIR__ . '/loader.php';\n\n$client = new SendGrid\\Client();\n```\n\n\u003ca name=\"quick-start\"\u003e\u003c/a\u003e\n# Quick Start\n\nHere is a quick example:\n\n`GET /your/api/{param}/call`\n\n```php\n// include __DIR__ . '/loader.php';\nrequire 'vendor/autoload.php';\n$apiKey = YOUR_SENDGRID_API_KEY;\n$authHeaders = [\n    'Authorization: Bearer ' . $apiKey\n];\n$client = new SendGrid\\Client('https://api.sendgrid.com', $authHeaders);\n$param = 'foo';\n$response = $client-\u003eyour()-\u003eapi()-\u003e_($param)-\u003ecall()-\u003eget();\n\nvar_dump(\n    $response-\u003estatusCode(),\n    $response-\u003eheaders(),\n    $response-\u003ebody()\n);\n```\n\n`POST /your/api/{param}/call` with headers, query parameters and a request body with versioning.\n\n```php\n// include __DIR__ . '/loader.php';\nrequire 'vendor/autoload.php';\n$apiKey = YOUR_SENDGRID_API_KEY;\n$authHeaders = [\n    'Authorization: Bearer ' . $apiKey\n];\n$client = new SendGrid\\Client('https://api.sendgrid.com', $authHeaders);\n$queryParams = [\n    'hello' =\u003e 0, 'world' =\u003e 1\n];\n$requestHeaders = [\n    'X-Test' =\u003e 'test'\n];\n$data = [\n    'some' =\u003e 1, 'awesome' =\u003e 2, 'data' =\u003e 3\n];\n$param = 'bar';\n$response = $client-\u003eyour()-\u003eapi()-\u003e_($param)-\u003ecall()-\u003epost($data, $queryParams, $requestHeaders);\n\nvar_dump(\n    $response-\u003estatusCode(),\n    $response-\u003eheaders(),\n    $response-\u003ebody()\n);\n```\n\nIf there is an issues with the request, such as misconfigured CURL SSL options, an `InvalidRequest` will be thrown\nwith message from CURL on why the request failed. Use the message as a hit to troubleshooting steps of your environment.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n# Usage\n\n- [Usage Examples](USAGE.md)\n\n## Environment Variables\n\nYou can do the following to create a .env file:\n\n```cp .env_example .env```\n\nThen, just add your API Key into your .env file.\n\n\u003ca name=\"contribute\"\u003e\u003c/a\u003e\n# How to Contribute\n\nWe encourage contribution to our libraries, please see our [CONTRIBUTING](CONTRIBUTING.md) guide for details.\n\nQuick links:\n\n- [Feature Request](CONTRIBUTING.md#feature-request)\n- [Bug Reports](CONTRIBUTING.md#submit-a-bug-report)\n- [Improvements to the Codebase](CONTRIBUTING.md#improvements-to-the-codebase)\n- [Review Pull Requests](CONTRIBUTING.md#code-reviews)\n\n\u003ca name=\"thanks\"\u003e\u003c/a\u003e\n# Thanks\n\nWe were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient).\n\n\u003ca name=\"about\"\u003e\u003c/a\u003e\n# About\n\nphp-http-client is maintained and funded by Twilio SendGrid, Inc. The names and logos for php-http-client are trademarks of Twilio SendGrid, Inc.\n\n\u003ca name=\"support\"\u003e\n# Support\n\nIf you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n# License\n[The MIT License (MIT)](LICENSE)\n","funding_links":[],"categories":["Programming Languages"],"sub_categories":["PHP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendgrid%2Fphp-http-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsendgrid%2Fphp-http-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendgrid%2Fphp-http-client/lists"}