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.4(1y ago)3060.6k↓17.4%3MITPHPPHP ^8.0CI passing

Since Oct 20Pushed 1y 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 1mo ago

READMEChangelog (4)Dependencies (8)Versions (7)Used By (0)

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

[](#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

44

—

FairBetter than 92% of packages

Maintenance49

Moderate activity, may be stable

Popularity41

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.2% 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 ~187 days

Recently: every ~204 days

Total

6

Last Release

369d 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 (27 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

[ixudra/curl

Custom PHP Curl library for the Laravel framework - developed by Ixudra

5594.5M90](/packages/ixudra-curl)[pusher/pusher-http-laravel

\[DEPRECATED\] A Pusher bridge for Laravel

400509.0k3](/packages/pusher-pusher-http-laravel)[vinelab/http

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

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

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

935.3k](/packages/laravel-shift-curl-converter)[kozz/laravel-guzzle-provider

Guzzle 5/6 Service Provider for Laravel

621.1M2](/packages/kozz-laravel-guzzle-provider)[tomschlick/request-migrations

HTTP Request Migrations

1844.5k](/packages/tomschlick-request-migrations)

PHPackages © 2026

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