alexkart/curl-builder
Generate reproducible curl commands from PSR-7 ServerRequest instances or build them manually. Add, set, and override options (with or without arguments), set URLs, and output a ready-to-run curl string—useful for debugging HTTP requests and sharing examples.
Use Case Alignment (Unchanged, but clarified with new context):
Non-Functional Fit (Unchanged):
Laravel Ecosystem Compatibility (Unchanged, but reinforced):
Technical Risk (Updated: Reduced):
curl generation for edge cases (e.g., repeated headers).curl generation be opt-in per environment (e.g., APP_DEBUG + APP_ENV=local) or route-specific (e.g., middleware for /debug/*)?Authorization headers) be handled in logs? Redact or deduplicate?tap() or spatie/laravel-activitylog for structured debugging.Laravel-Specific Leverage (Unchanged, but prioritized):
public function handle(Request $request, Closure $next) {
$response = $next($request);
if ($request->is('debug/*')) {
Log::debug('Curl:', CurlBuilder::build($request));
}
return $response;
}
HTTP Client Integration (New Consideration):
Middleware in the stack.Client facade to auto-generate curl for failed requests.1.1.0 (composer update alexkart/curl-builder).curl logging (e.g., /debug/webhooks).curl logs (e.g., tokens, passwords).curl generation in non-debug environments (e.g., Sentry rule).curl extension still optional for generation (but required for execution).tap() or Pest/PhpUnit for testing.| Step | Priority | Dependencies | Owner | Notes |
|---|---|---|---|---|
| Upgrade package | High | None | Backend Dev | composer update |
| Test edge cases | High | Package upgrade | QA | Duplicate headers, multipart requests |
| Middleware setup | Medium | Upgrade | Backend Dev | Route-specific logging |
| Artisan command | Low | Middleware | Backend Dev | CLI debugging |
| Redaction layer | Medium | Middleware | Security Team | Handle sensitive data in curl logs |
| Documentation | High | All integrations | Tech Writer | Highlight PHP 8.4 support, fixes |
curl generation.Log::mask() or a custom redaction middleware for curl logs.| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
curl generation in production |
Noise/log bloat | Environment toggle (APP_DEBUG) + route whitelist |
| Sensitive data in logs | Security breach | New: Redaction middleware for curl logs |
| Duplicate options in requests | Inconsistent curl output |
Fixed: PR #14 ensures deterministic output |
| High request volume | Logging overhead | Disable for non-debug routes |
| PHP 8.4 incompatibility | Broken generation | Mitigated: CI-tested; no action needed |
1.1.0 fixes (e.g., duplicate options).curl output for a request with repeated headers.curl commands (no duplicates).curl generation).How can I help you explore Laravel packages today?