PHPackages                             jigarakatidus/laravel-http-to-curl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. jigarakatidus/laravel-http-to-curl

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jigarakatidus/laravel-http-to-curl
==================================

Extended Http to dump and die with Curl command

1.0.5(4mo ago)3379.7k↓54.3%2MITPHPPHP ^8.0CI passing

Since Oct 20Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/jigar-dhulla/laravel-http-to-curl)[ Packagist](https://packagist.org/packages/jigarakatidus/laravel-http-to-curl)[ Docs](https://github.com/jigarakatidus/laravel-http-to-curl)[ RSS](/packages/jigarakatidus-laravel-http-to-curl/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (5)Dependencies (16)Versions (9)Used By (0)

Laravel HTTP to Curl
====================

[](#laravel-http-to-curl)

[![Laravel Compatibility](https://camo.githubusercontent.com/c855a0d20a3e17702d887f19fe7edad63edb9119b63eae1fe69f81be1d59cbd4/68747470733a2f2f62616467652e6c61726176656c2e636c6f75642f62616467652f6a69676172616b6174696475732f6c61726176656c2d687474702d746f2d6375726c3f7374796c653d666c6174)](https://packagist.org/packages/jigarakatidus/laravel-http-to-curl)[![Latest Version on Packagist](https://camo.githubusercontent.com/afcc90a1c61ad25a475c5bb8b9f88ea98aa20d5f4de22e1c08fde440fcbb930a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a69676172616b6174696475732f6c61726176656c2d687474702d746f2d6375726c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jigar-dhulla/laravel-http-to-curl)[![GitHub Tests Action Status](https://camo.githubusercontent.com/16e29352f82beec2876aca0fe7b66ea4fe369d17670452f331bb714ee8ba2fbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a696761722d6468756c6c612f6c61726176656c2d687474702d746f2d6375726c2f7068702e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jigar-dhulla/laravel-http-to-curl/actions/workflows/php.yml)[![Total Downloads](https://camo.githubusercontent.com/baff163e15b2777659d1704a2d4a416ffa42e3cbe6133204b3b4fd2a34595a57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a69676172616b6174696475732f6c61726176656c2d687474702d746f2d6375726c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jigarakatidus/laravel-http-to-curl)

This package has two use-cases:

1. Simple dump and die with curl command for local development for troubleshooting the http request.
2. Enable logging curl command for each request in the logs.

Installation
------------

[](#installation)

You can pull in the package via composer:

```
composer require jigarakatidus/laravel-http-to-curl
```

The package will automatically register itself

Usage
-----

[](#usage)

### Basic GET Request

[](#basic-get-request)

```
Http::ddWithCurl()
    ->get('https://example.com/api/resource');
```

Outputs

```
curl -H 'User-Agent: GuzzleHttp/7' -X 'GET' 'https://example.com/api/resource'
```

### GET Request with Query Parameters

[](#get-request-with-query-parameters)

```
Http::ddWithCurl()
    ->get('https://example.com/api/resource', [
        'param1' => 'value1',
        'param2' => 'value2',
    ]);
```

Outputs

```
curl -H 'User-Agent: GuzzleHttp/7' -X 'GET' 'https://example.com/api/resource?param1=value1&param2=value2'
```

### POST Request with JSON Payload

[](#post-request-with-json-payload)

```
Http::ddWithCurl()
    ->acceptJson()
    ->post('https://example.com/api/resource', [
        'key1' => 'value1',
        'key2' => 'value2',
    ]);
```

Outputs

```
curl -H 'User-Agent: GuzzleHttp/7' -H 'Accept: application/json' -H 'Content-Type: application/json' -X 'POST' 'https://example.com/api/resource' -d '{"key1":"value1","key2":"value2"}'
```

Automatic Request Logging
-------------------------

[](#automatic-request-logging)

To enable the automatic logging of curl command for each request, configure these options directly through environment variables:

- `HTTP_TO_CURL_LOGGING`: Enable/disable logging (defaults to false)
- `HTTP_TO_CURL_LOG_LEVEL`: Set log level (defaults to "debug")
- `HTTP_TO_CURL_LOG_CHANNEL`: Select log channel (defaults to "stack")

Optionally, you can publish the configuration file using the following command:

```
php artisan vendor:publish --tag=http-to-curl-config
```

This will create a `config/http-to-curl.php` file where you can customize the logging behavior.

### Logging Example

[](#logging-example)

When you enable logging by setting `HTTP_TO_CURL_LOGGING=true` in your environment, all HTTP requests will be automatically logged. For example, if your application makes this request:

```
Http::post('https://api.example.com/users', [
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);
```

This cURL command will be automatically logged to your configured log channel:

```
[2025-05-13 23:53:46] local.DEBUG: curl -H 'User-Agent: GuzzleHttp/7' -H 'Content-Type: application/json' -X 'POST' 'https://api.example.com/users' -d '{"name":"John Doe","email":"john@example.com"}'

```

This is useful for debugging API calls in both development and production environments.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Pull Requests are welcome.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jigar Dhulla](https://github.com/jigarakatidus)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance77

Regular maintenance activity

Popularity41

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~210 days

Recently: every ~178 days

Total

7

Last Release

138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd37364fd509a890b4ba371bc90b7cf68aff2a730e202e81503596260e2df486?d=identicon)[jigarakatidus](/maintainers/jigarakatidus)

---

Top Contributors

[![jigar-dhulla](https://avatars.githubusercontent.com/u/3132291?v=4)](https://github.com/jigar-dhulla "jigar-dhulla (30 commits)")[![MrPunyapal](https://avatars.githubusercontent.com/u/53343069?v=4)](https://github.com/MrPunyapal "MrPunyapal (7 commits)")[![noatudor](https://avatars.githubusercontent.com/u/143794128?v=4)](https://github.com/noatudor "noatudor (3 commits)")[![matthewnessworthy](https://avatars.githubusercontent.com/u/5653887?v=4)](https://github.com/matthewnessworthy "matthewnessworthy (1 commits)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (1 commits)")

---

Tags

convertercurlhttphttp-requestlaravelhttplaravelcurllaravel-http-to-curl

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jigarakatidus-laravel-http-to-curl/health.svg)

```
[![Health](https://phpackages.com/badges/jigarakatidus-laravel-http-to-curl/health.svg)](https://phpackages.com/packages/jigarakatidus-laravel-http-to-curl)
```

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[vinelab/http

An http library developed for the laravel framework. aliases itself as HttpClient

57304.2k11](/packages/vinelab-http)[laravel-shift/curl-converter

A command line tool to convert curl requests to Laravel HTTP requests.

935.5k](/packages/laravel-shift-curl-converter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
