{"id":28254937,"url":"https://github.com/chargebee/chargebee-php","last_synced_at":"2026-01-20T12:07:05.337Z","repository":{"id":407525,"uuid":"4184017","full_name":"chargebee/chargebee-php","owner":"chargebee","description":"PHP library for the Chargebee API.","archived":false,"fork":false,"pushed_at":"2026-01-12T13:12:18.000Z","size":2061,"stargazers_count":76,"open_issues_count":9,"forks_count":68,"subscribers_count":37,"default_branch":"master","last_synced_at":"2026-01-12T16:33:37.112Z","etag":null,"topics":["chargebee","php"],"latest_commit_sha":null,"homepage":"https://apidocs.chargebee.com/docs/api?lang=php","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/chargebee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-04-30T15:28:39.000Z","updated_at":"2026-01-12T13:12:19.000Z","dependencies_parsed_at":"2024-05-02T11:56:00.109Z","dependency_job_id":"2d2b7129-abc8-4ef6-986d-61b6e2bb23cb","html_url":"https://github.com/chargebee/chargebee-php","commit_stats":{"total_commits":265,"total_committers":17,"mean_commits":"15.588235294117647","dds":0.6830188679245284,"last_synced_commit":"38c343fc63ee15735478b18526721100558e3219"},"previous_names":[],"tags_count":245,"template":false,"template_full_name":null,"purl":"pkg:github/chargebee/chargebee-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chargebee","download_url":"https://codeload.github.com/chargebee/chargebee-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"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":["chargebee","php"],"created_at":"2025-05-19T20:16:31.070Z","updated_at":"2026-01-20T12:07:05.331Z","avatar_url":"https://github.com/chargebee.png","language":"PHP","readme":"# Chargebee PHP Client Library - API V2\n\n[![Packagist](https://img.shields.io/packagist/v/chargebee/chargebee-php.svg?maxAge=3)](https://packagist.org/packages/chargebee/chargebee-php)\n[![Packagist](https://img.shields.io/packagist/dt/chargebee/chargebee-php.svg?maxAge=3)](https://packagist.org/packages/chargebee/chargebee-php/stats)\n[![Packagist](https://img.shields.io/packagist/dm/chargebee/chargebee-php.svg?maxAge=3)](https://packagist.org/packages/chargebee/chargebee-php/stats)\n[![Packagist](https://img.shields.io/packagist/l/chargebee/chargebee-php.svg?maxAge=3)](https://packagist.org/packages/chargebee/chargebee-php)\n\n\u003e [!NOTE]\n\u003e [![Join Discord](https://img.shields.io/badge/Discord-Early%20Access-blue?logo=discord\u0026logoColor=white)](https://discord.gg/S3SXDzXHAg)\n\u003e\n\u003e We are trialing a Discord server for developers building with Chargebee. Limited spots are open on a first-come basis. Join [here](https://discord.gg/gpsNqnhDm2) if interested.\n\n\nThis is the official PHP library for integrating with Chargebee.\n\n- 📘 For a complete reference of available APIs, check out our [API Documentation](https://apidocs.chargebee.com/docs/api/?lang=php).  \n- 🧪 To explore and test API capabilities interactively, head over to our [API Explorer](https://api-explorer.chargebee.com).\n\n\u003eNote: Chargebee now supports two API versions - [V1](https://apidocs.chargebee.com/docs/api/v1) and [V2](https://apidocs.chargebee.com/docs/api), of which V2 is the latest release and all future developments will happen in V2. This library is for \u003cb\u003eAPI version V2\u003c/b\u003e. If you’re looking for V1, head to [chargebee-v1 branch](https://github.com/chargebee/chargebee-php/tree/chargebee-v1).\n\n## Requirements\n\nPHP 8.1 or later\n\n## Installation\n\n### Composer\n```Chargebee``` is available on [Packagist](https://packagist.org/packages/chargebee/chargebee-php) and can be installed using [Composer](https://getcomposer.org/)\n\n\u003cpre\u003e\u003ccode\u003ecomposer require chargebee/chargebee-php\u003c/code\u003e\u003c/pre\u003e\n\nTo use the bindings, \n\u003cpre\u003e\u003ccode\u003erequire_once('vendor/autoload.php');\u003c/code\u003e\u003c/pre\u003e\n\n## Usage\n\n### To create a new subscription:\n\n```php\nuse Chargebee\\ChargebeeClient;\n\n$chargebee = new ChargebeeClient(options: [\n    \"site\" =\u003e \"{your_site}\",\n    \"apiKey\" =\u003e \"{your_apiKey}\",\n]);\n\n$result = $chargebee-\u003esubscription()-\u003ecreateWithItems(\"customer_id\", [\n    \"subscription_items\" =\u003e [\n        [\n            \"item_price_id\" =\u003e \"Montly-Item\",\n            \"quantity\" =\u003e \"3\",\n        ]\n    ]\n]);\n$subscription = $result-\u003esubscription;\n$customer = $result-\u003ecustomer;\n\n```\n\n### Create an idempotent request\n\n[Idempotency keys](https://apidocs.chargebee.com/docs/api/idempotency?prod_cat_ver=2) are passed along with request headers to allow a safe retry of POST requests. \n\n```php\nuse Chargebee\\ChargebeeClient;\n\n$chargebee = new ChargebeeClient(options: [\n    \"site\" =\u003e \"{your_site}\",\n    \"apiKey\" =\u003e \"{your_apiKey}\",\n]);\n$responseCustomer = $chargebee-\u003ecustomer()-\u003ecreate([\n    \"first_name\" =\u003e \"John\",\n    \"last_name\" =\u003e \"Doe\",\n    \"email\" =\u003e \"john@test.com\",\n    \"card\" =\u003e [\n        \"first_name\" =\u003e \"Joe\",\n        \"last_name\" =\u003e \"Doe\",\n        \"number\" =\u003e \"4012888888881881\",\n        \"expiry_month\" =\u003e \"10\",\n        \"expiry_year\" =\u003e \"29\",\n        \"cvv\" =\u003e \"231\"\n        ]\n    ],\n    [\n        \"chargebee-idempotency-key\" =\u003e \"\u003c\u003cUUID\u003e\u003e\" // Replace \u003c\u003cUUID\u003e\u003e with a unique string\n    ]\n);\n$responseHeaders = $responseCustomer-\u003egetResponseHeaders(); // Retrieves response headers\nprint_r($responseHeaders);\n$idempotencyReplayedValue = $responseCustomer-\u003eisIdempotencyReplayed(); // Retrieves Idempotency replayed header value\nprint_r($idempotencyReplayedValue);\n```\n`isIdempotencyReplayed()` method can be accessed to differentiate between original and replayed requests.\n\n\n### Retry Handling\n\nChargebee's SDK includes built-in retry logic to handle temporary network issues and server-side errors. This feature is **disabled by default** but can be **enabled when needed**.\n\n#### Key features include:\n\n- **Automatic retries for specific HTTP status codes**: Retries are automatically triggered for status codes `500`, `502`, `503`, and `504`.\n- **Exponential backoff**: Retry delays increase exponentially to prevent overwhelming the server.\n- **Rate limit management**: If a `429 Too Many Requests` response is received with a `Retry-After` header, the SDK waits for the specified duration before retrying.\n  \u003e *Note: Exponential backoff and max retries do not apply in this case.*\n- **Customizable retry behavior**: Retry logic can be configured using the `retryConfig` parameter in the environment configuration.\n\n#### Example: Customizing Retry Logic\n\nYou can enable and configure the retry logic by passing a `retryConfig` object when initializing the Chargebee environment:\n\n```php\nuse Chargebee\\ChargebeeClient;\n\n// Retry Configurations\n$retryConfig = new RetryConfig();\n$retryConfig-\u003esetEnabled(true); // Enable retry mechanism\n$retryConfig-\u003esetMaxRetries(5); // Maximum number of retries\n$retryConfig-\u003esetDelayMs(1000); // Delay in milliseconds before retrying\n$retryConfig-\u003esetRetryOn([500, 502, 503, 504]); // Retry on these HTTP status codes\n\n$chargebee = new ChargebeeClient(options: [\n    \"site\" =\u003e \"{your_site}\",\n    \"apiKey\" =\u003e \"{your_apiKey}\",\n    \"retryConfig\" =\u003e $retryConfig,\n]);\n\n// ... your Chargebee API operations below ...\n\n```\n\n#### Example: Rate Limit retry logic\n\nYou can enable and configure the retry logic for rate-limit by passing a `retryConfig` object when initializing the Chargebee environment:\n\n```php\nuse Chargebee\\ChargebeeClient;\n\n// Retry Configurations\n$retryConfig = new RetryConfig();\n$retryConfig-\u003esetEnabled(true); // Enable retry mechanism\n$retryConfig-\u003esetMaxRetries(5); // Maximum number of retries\n$retryConfig-\u003esetDelayMs(1000); // Delay in milliseconds before retrying\n$retryConfig-\u003esetRetryOn([429]); // Retry on 429 HTTP status codes\n\n$chargebee = new ChargebeeClient(options: [\n    \"site\" =\u003e \"{your_site}\",\n    \"apiKey\" =\u003e \"{your_apiKey}\",\n    \"retryConfig\" =\u003e $retryConfig,\n]);\n\n// ... your Chargebee API operations below ...\n\n```\n\n## License\n\nSee the LICENSE file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchargebee%2Fchargebee-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchargebee%2Fchargebee-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchargebee%2Fchargebee-php/lists"}