https://github.com/jigar-dhulla/laravel-http-to-curl
Laravel HTTP Request to Curl Command
https://github.com/jigar-dhulla/laravel-http-to-curl
converter curl http http-request laravel
Last synced: about 1 month ago
JSON representation
Laravel HTTP Request to Curl Command
- Host: GitHub
- URL: https://github.com/jigar-dhulla/laravel-http-to-curl
- Owner: jigar-dhulla
- License: mit
- Created: 2022-10-14T21:25:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-26T18:47:06.000Z (3 months ago)
- Last Synced: 2025-03-26T23:08:28.225Z (about 2 months ago)
- Topics: converter, curl, http, http-request, laravel
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 25
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel HTTP to Curl
Simple tool to dump the raw curl command from Laravel HTTP Request.
## Installation
You can pull in the package via composer:
``` bash
composer require --dev jigarakatidus/laravel-http-to-curl
```The package will automatically register itself
## Usage
### Basic GET Request
```php
Http::ddWithCurl()
->get('https://example.com/api/resource');
```Outputs
```bash
curl -H 'User-Agent: GuzzleHttp/7' -X 'GET' 'https://example.com/api/resource'
```### GET Request with Query Parameters
```php
Http::ddWithCurl()
->get('https://example.com/api/resource', [
'param1' => 'value1',
'param2' => 'value2',
]);
```Outputs
```bash
curl -H 'User-Agent: GuzzleHttp/7' -X 'GET' 'https://example.com/api/resource?param1=value1¶m2=value2'
```### POST Request with JSON Payload
```php
Http::ddWithCurl()
->acceptJson()
->post('https://example.com/api/resource', [
'key1' => 'value1',
'key2' => 'value2',
]);
```Outputs
```bash
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"}'
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```## Contributing
Pull Requests are welcome.
## Security
If you've found a bug regarding security please mail [[email protected]](mailto:[email protected]) instead of using the issue tracker.
## Credits
- [Jigar Dhulla](https://github.com/jigarakatidus)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.