[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8445":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":30,"discoverSource":31},8445,"stripe-php","stripe\u002Fstripe-php","stripe","PHP library for the Stripe API.    ","https:\u002F\u002Fstripe.com",null,"PHP",4010,890,109,11,0,2,15,1,30.85,"MIT License",false,"master",true,[7,26],"stripe-sdk","2026-06-12 02:01:53","# Stripe PHP bindings\n\n[![Build Status](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?branch=master)](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Factions?query=branch%3Amaster)\n[![Latest Stable Version](https:\u002F\u002Fposer.pugx.org\u002Fstripe\u002Fstripe-php\u002Fv\u002Fstable.svg)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fstripe\u002Fstripe-php)\n[![Total Downloads](https:\u002F\u002Fposer.pugx.org\u002Fstripe\u002Fstripe-php\u002Fdownloads.svg)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fstripe\u002Fstripe-php)\n[![License](https:\u002F\u002Fposer.pugx.org\u002Fstripe\u002Fstripe-php\u002Flicense.svg)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fstripe\u002Fstripe-php)\n\n> [!TIP]\n> Want to chat live with Stripe engineers? Join us on our [Discord server](https:\u002F\u002Fstripe.com\u002Fgo\u002Fdiscord\u002Fphp).\n\nThe Stripe PHP library provides convenient access to the Stripe API from\napplications written in the PHP language. It includes a pre-defined set of\nclasses for API resources that initialize themselves dynamically from API\nresponses which makes it compatible with a wide range of versions of the Stripe\nAPI.\n\n## Requirements\n\nPHP 7.2.0 and later.\n\nNote that per our [language version support policy](https:\u002F\u002Fdocs.stripe.com\u002Fsdks\u002Fversioning?lang=php#stripe-sdk-language-version-support-policy), support for PHP 7.2 and 7.3 will be removed soon, so upgrade your runtime if you're able to.\n\nAdditional PHP versions will be dropped in future major versions, so upgrade to supported versions if possible.\n\n## Composer\n\nYou can install the bindings via [Composer](http:\u002F\u002Fgetcomposer.org\u002F). Run the following command:\n\n```bash\ncomposer require stripe\u002Fstripe-php\n```\n\nTo use the bindings, use Composer's [autoload](https:\u002F\u002Fgetcomposer.org\u002Fdoc\u002F01-basic-usage.md#autoloading):\n\n```php\nrequire_once 'vendor\u002Fautoload.php';\n```\n\n## Manual Installation\n\nIf you do not wish to use Composer, you can download the [latest release](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Freleases). Then, to use the bindings, include the `init.php` file.\n\n```php\nrequire_once '\u002Fpath\u002Fto\u002Fstripe-php\u002Finit.php';\n```\n\n## Dependencies\n\nThe bindings require the following extensions in order to work properly:\n\n- [`curl`](https:\u002F\u002Fsecure.php.net\u002Fmanual\u002Fen\u002Fbook.curl.php), although you can use your own non-cURL client if you prefer\n- [`json`](https:\u002F\u002Fsecure.php.net\u002Fmanual\u002Fen\u002Fbook.json.php)\n- [`mbstring`](https:\u002F\u002Fsecure.php.net\u002Fmanual\u002Fen\u002Fbook.mbstring.php) (Multibyte String)\n\nIf you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.\n\n## Getting Started\n\nSimple usage looks like:\n\n```php\n$stripe = new \\Stripe\\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2');\n$customer = $stripe->customers->create([\n    'description' => 'example customer',\n    'email' => 'email@example.com',\n    'payment_method' => 'pm_card_visa',\n]);\necho $customer;\n```\n\n### Client\u002Fservice patterns vs legacy patterns\n\nYou can continue to use the legacy integration patterns used prior to version [7.33.0](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Fblob\u002Fmaster\u002FCHANGELOG.md#7330---2020-05-14). Review the [migration guide](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Fwiki\u002FMigration-to-StripeClient-and-services-in-7.33.0) for the backwards-compatible client\u002Fservices pattern changes.\n\n## Documentation\n\nSee the [PHP API docs](https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi\u002F?lang=php#intro).\n\n## Legacy Version Support\n\n### PHP 5.4 & 5.5\n\nIf you are using PHP 5.4 or 5.5, you should consider upgrading your environment as those versions have been past end of life since September 2015 and July 2016 respectively.\nOtherwise, you can still use Stripe by downloading stripe-php v6.43.1 ([zip](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Farchive\u002Fv6.43.1.zip), [tar.gz](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Farchive\u002F6.43.1.tar.gz)) from our [releases page](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Freleases). This version will work but might not support recent features we added since the version was released and upgrading PHP is the best course of action.\n\n### PHP 5.3\n\nIf you are using PHP 5.3, you should upgrade your environment as this version has been past end of life since August 2014.\nOtherwise, you can download v5.9.2 ([zip](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Farchive\u002Fv5.9.2.zip), [tar.gz](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Farchive\u002Fv5.9.2.tar.gz)) from our [releases page](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php\u002Freleases). This version will continue to work with new versions of the Stripe API for all common uses.\n\n## Custom Request Timeouts\n\n> **Note**\n> We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi\u002F?lang=php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.\n\nTo modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.\n\n```php\n\u002F\u002F set up your tweaked Curl client\n$curl = new \\Stripe\\HttpClient\\CurlClient();\n$curl->setTimeout(10); \u002F\u002F default is \\Stripe\\HttpClient\\CurlClient::DEFAULT_TIMEOUT\n$curl->setConnectTimeout(5); \u002F\u002F default is \\Stripe\\HttpClient\\CurlClient::DEFAULT_CONNECT_TIMEOUT\n\necho $curl->getTimeout(); \u002F\u002F 10\necho $curl->getConnectTimeout(); \u002F\u002F 5\n\n\u002F\u002F tell Stripe to use the tweaked client\n\\Stripe\\ApiRequestor::setHttpClient($curl);\n\n\u002F\u002F use the Stripe API client as you normally would\n```\n\n## Custom cURL Options (e.g. proxies)\n\nNeed to set a proxy for your requests? Pass in the requisite `CURLOPT_*` array to the CurlClient constructor, using the same syntax as `curl_stopt_array()`. This will set the default cURL options for each HTTP request made by the SDK, though many more common options (e.g. timeouts; see above on how to set those) will be overridden by the client even if set here.\n\n```php\n\u002F\u002F set up your tweaked Curl client\n$curl = new \\Stripe\\HttpClient\\CurlClient([CURLOPT_PROXY => 'proxy.local:80']);\n\u002F\u002F tell Stripe to use the tweaked client\n\\Stripe\\ApiRequestor::setHttpClient($curl);\n```\n\nAlternately, a callable can be passed to the CurlClient constructor that returns the above array based on request inputs. See `testDefaultOptions()` in `tests\u002FCurlClientTest.php` for an example of this behavior. Note that the callable is called at the beginning of every API request, before the request is sent.\n\n### Configuring a Logger\n\nThe library does minimal logging, but it can be configured\nwith a [`PSR-3` compatible logger][psr3] so that messages\nend up there instead of `error_log`:\n\n```php\n\\Stripe\\Stripe::setLogger($logger);\n```\n\n### Accessing response data\n\nYou can access the data from the last API response on any object via `getLastResponse()`.\n\n```php\n$customer = $stripe->customers->create([\n    'description' => 'example customer',\n]);\necho $customer->getLastResponse()->headers['Request-Id'];\n```\n\n### SSL \u002F TLS compatibility issues\n\nStripe's API now requires that [all connections use TLS 1.2](https:\u002F\u002Fstripe.com\u002Fblog\u002Fupgrading-tls). Some systems (most notably some older CentOS and RHEL versions) are capable of using TLS 1.2 but will use TLS 1.0 or 1.1 by default. In this case, you'd get an `invalid_request_error` with the following error message: \"Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at [https:\u002F\u002Fstripe.com\u002Fblog\u002Fupgrading-tls](https:\u002F\u002Fstripe.com\u002Fblog\u002Fupgrading-tls).\".\n\nThe recommended course of action is to [upgrade your cURL and OpenSSL packages](https:\u002F\u002Fsupport.stripe.com\u002Fquestions\u002Fhow-do-i-upgrade-my-stripe-integration-from-tls-1-0-to-tls-1-2#php) so that TLS 1.2 is used by default, but if that is not possible, you might be able to solve the issue by setting the `CURLOPT_SSLVERSION` option to either `CURL_SSLVERSION_TLSv1` or `CURL_SSLVERSION_TLSv1_2`:\n\n```php\n$curl = new \\Stripe\\HttpClient\\CurlClient([CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]);\n\\Stripe\\ApiRequestor::setHttpClient($curl);\n```\n\n### Per-request Configuration\n\nFor apps that need to use multiple keys during the lifetime of a process, like\none that uses [Stripe Connect][connect], it's also possible to set a\nper-request key and\u002For account:\n\n```php\n$customers = $stripe->customers->all([],[\n    'api_key' => 'sk_test_...',\n    'stripe_account' => 'acct_...'\n]);\n\n$stripe->customers->retrieve('cus_123456789', [], [\n    'api_key' => 'sk_test_...',\n    'stripe_account' => 'acct_...'\n]);\n```\n\n### Configuring CA Bundles\n\nBy default, the library will use its own internal bundle of known CA\ncertificates, but it's possible to configure your own:\n\n```php\n\\Stripe\\Stripe::setCABundlePath(\"path\u002Fto\u002Fca\u002Fbundle\");\n```\n\n### Configuring Automatic Retries\n\nThe library can be configured to automatically retry requests that fail due to\nan intermittent network problem:\n\n```php\n\\Stripe\\Stripe::setMaxNetworkRetries(2);\n```\n\n[Idempotency keys][idempotency-keys] are added to requests to guarantee that\nretries are safe.\n\n### Telemetry\n\nBy default, the library sends telemetry to Stripe regarding request latency and feature usage. These\nnumbers help Stripe improve the overall latency of its API for all users, and\nimprove popular features.\n\nYou can disable this behavior if you prefer:\n\n```php\n\\Stripe\\Stripe::setEnableTelemetry(false);\n```\n\n### How to use undocumented parameters and properties\n\nIn some cases, you might encounter parameters on an API request or fields on an API response that aren’t available in the SDKs.\nThis might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.\nSee [undocumented params and properties](https:\u002F\u002Fdocs.stripe.com\u002Fsdks\u002Fserver-side?lang=php#undocumented-params-and-fields) to send those parameters or access those fields.\n\n### Public Preview SDKs\n\nStripe has features in the [public preview phase](https:\u002F\u002Fdocs.stripe.com\u002Frelease-phases) that can be accessed via versions of this package that have the `-beta.X` suffix like `12.2.0-beta.2`.\nWe would love for you to try these as we incrementally release new features and improve them based on your feedback.\n\nThe public preview SDKs are a different version of the same package as the stable SDKs. These versions are appended with `-beta.X` such as `15.0.0-beta.1`. To install, pick the latest version with the `beta` suffix by reviewing the [releases page](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-dotnet\u002Freleases\u002F) and then use it in the `composer require` command:\n\n```bash\ncomposer require stripe\u002Fstripe-php:v\u003Creplace-with-the-version-of-your-choice>\n```\n\n> **Note**\n> There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific version in your composer.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest version of the public preview SDK.\n\nSome preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If the preview feature you are interested in has this requirement, use the function `addBetaVersion` (available only in the public preview SDKs):\n\n```php\nStripe::addBetaVersion(\"feature_beta\", \"v3\");\n```\n\n### Private Preview SDKs\n\nStripe has features in the [private preview phase](https:\u002F\u002Fdocs.stripe.com\u002Frelease-phases) that can be accessed via versions of this package that have the `-alpha.X` suffix like `12.2.0-alpha.2`. These are invite-only features. Once invited, you can install the private preview SDKs by following the same instructions as for the [public preview SDKs](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-php?tab=readme-ov-file#public-preview-sdks) above and replacing the term `beta` with `alpha`.\n\n### Custom requests\n\n> This feature is only available from version 16 of this SDK.\n\nIf you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `rawRequest` method on the StripeClient.\n\n```php\n$stripe = new \\Stripe\\StripeClient('sk_test_xyz');\n$response = $stripe->rawRequest('post', '\u002Fv1\u002Fbeta_endpoint', [\n  \"caveat\": \"emptor\"\n], [\n  \"stripe_version\" => \"2022-11_15\",\n]);\n\u002F\u002F $response->body is a string, you can call $stripe->deserialize to get a \\Stripe\\StripeObject.\n$obj = $stripe->deserialize($response->body);\n\n\u002F\u002F For GET requests, the params argument must be null, and you should write the query string explicitly.\n$get_response = $stripe->rawRequest('get', '\u002Fv1\u002Fbeta_endpoint?caveat=emptor', null, [\n  \"stripe_version\" => \"2022-11_15\",\n]);\n```\n\n## Support\n\nNew features and bug fixes are released on the latest major version of the Stripe PHP library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.\n\n## Development\n\n[Contribution guidelines for this project](CONTRIBUTING.md)\n\nWe use [just](https:\u002F\u002Fgithub.com\u002Fcasey\u002Fjust) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`.\n\nTo get started, install [Composer][composer]. For example, on Mac OS:\n\n```bash\nbrew install composer\n```\n\nInstall dependencies:\n\n```bash\njust install\n# or: composer install\n```\n\nThe test suite depends on [stripe-mock], so make sure to fetch and run it from a\nbackground terminal ([stripe-mock's README][stripe-mock] also contains\ninstructions for installing via Homebrew and other methods):\n\n```bash\ngo install github.com\u002Fstripe\u002Fstripe-mock@latest\nstripe-mock\n```\n\nInstall dependencies as mentioned above (which will resolve [PHPUnit](http:\u002F\u002Fpackagist.org\u002Fpackages\u002Fphpunit\u002Fphpunit)), then you can run the test suite:\n\n```bash\njust test\n# or: .\u002Fvendor\u002Fbin\u002Fphpunit\n```\n\nOr to run an individual test file:\n\n```bash\njust test tests\u002FStripe\u002FUtilTest.php\n# or: .\u002Fvendor\u002Fbin\u002Fphpunit tests\u002FStripe\u002FUtilTest.php\n```\n\nUpdate bundled CA certificates from the [Mozilla cURL release][curl]:\n\n```bash\n.\u002Fupdate_certs.php\n```\n\nThe library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with:\n\n```bash\njust format\n# or: .\u002Fvendor\u002Fbin\u002Fphp-cs-fixer fix -v .\n```\n\n## Attention plugin developers\n\nAre you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example:\n\n```php\n\\Stripe\\Stripe::setAppInfo(\"MyAwesomePlugin\", \"1.2.34\", \"https:\u002F\u002Fmyawesomeplugin.info\");\n```\n\nThe method should be called once, before any request is sent to the API. The second and third parameters are optional.\n\n### SSL \u002F TLS configuration option\n\nSee the \"SSL \u002F TLS compatibility issues\" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`.\n\n[composer]: https:\u002F\u002Fgetcomposer.org\u002F\n[connect]: https:\u002F\u002Fstripe.com\u002Fconnect\n[curl]: http:\u002F\u002Fcurl.haxx.se\u002Fdocs\u002Fcaextract.html\n[idempotency-keys]: https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi\u002F?lang=php#idempotent_requests\n[php-cs-fixer]: https:\u002F\u002Fgithub.com\u002FFriendsOfPHP\u002FPHP-CS-Fixer\n[psr3]: http:\u002F\u002Fwww.php-fig.org\u002Fpsr\u002Fpsr-3\u002F\n[stripe-mock]: https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-mock\n","Stripe PHP库为使用PHP语言编写的程序提供了便捷的Stripe API访问方式。它预定义了一系列API资源类，这些类能够根据API响应自动初始化，确保了与多种版本Stripe API的良好兼容性。项目支持PHP 7.2及以上版本，并推荐通过Composer进行安装以简化依赖管理过程。此外，该库还要求安装curl、json和mbstring等PHP扩展来保证正常运行。适用于需要在PHP应用中集成支付功能的场景，如电子商务网站或在线服务收费系统。","2026-06-11 03:17:57","top_language"]