clarkewing/cashier-nightwatch
Composer 安装命令:
composer require clarkewing/cashier-nightwatch
包简介
Surface Laravel Cashier (Stripe) API requests on Laravel Nightwatch timelines.
README 文档
README
Surface Stripe API requests — those made by Laravel Cashier and the Stripe PHP SDK — on your Laravel Nightwatch timelines, with the request URL redacted by default.
Stripe's PHP SDK uses its own cURL client, so its API calls bypass Nightwatch's Guzzle instrumentation and never show up on your timelines. This package swaps in a Nightwatch-aware cURL client so they do.
Installation
composer require clarkewing/cashier-nightwatch
The service provider is auto-discovered. To customise redaction, publish the config:
php artisan vendor:publish --tag=cashier-nightwatch-config
What is recorded — and redacted
Nightwatch stores only the method, URL, byte sizes and status code for an outgoing request — never request/response headers or bodies. Consequently:
- Your Stripe secret key (the
Authorizationheader) is never captured. - Request/response bodies (card data, customer PII on writes) are never captured — only their byte size.
- The URL is the only sensitive surface, because Stripe
list/searchcalls put filters such asemailorcustomerin the query string.
By default the package redacts query-string values while keeping the keys:
GET https://api.stripe.com/v1/customers?email=REDACTED&limit=REDACTED
Configuration
| Key | Default | Description |
|---|---|---|
enabled |
true |
Master switch. No-ops if Nightwatch is not installed. |
redact_query |
keys |
keys (redact values, keep names)drop (remove the query string)keep (leave as-is — may log PII). |
mask_path_ids |
false |
Mask Stripe IDs in the path, e.g. /v1/customers/cus_***. |
Each maps to an env var: CASHIER_NIGHTWATCH_ENABLED, CASHIER_NIGHTWATCH_REDACT_QUERY, CASHIER_NIGHTWATCH_MASK_PATH_IDS.
For full control you can also use Nightwatch's own hook in a service provider (the record's url is mutable):
use Laravel\Nightwatch\Facades\Nightwatch; Nightwatch::redactOutgoingRequests(function ($record) { $record->url = '...'; });
Compatibility
This integrates at the Stripe SDK level (Stripe\ApiRequestor::setHttpClient) and relies on a few Laravel Nightwatch internals (Core::$clock, Core::$config, outgoingRequest(), paused()). It targets Nightwatch 1.x and may need updating across a Nightwatch major version.
Streaming Stripe responses (requestStream) are not instrumented.
Testing
composer install
composer test
License
MIT — see LICENSE.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-22