Skip to content

wdavis/com.bfgdivision.PawExtensions.LaravelHttpCodeGenerator

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Laravel Http Code Generator for Paw

Easiest way to generate http request code for Laravel Http – its nicely formatted too!

Supports GET, POST, PUT, PATCH and DELETE requests.

Paw – The most advanced API tool for Mac

Installation

Clone this repo to: /Users/USERNAME/Library/Containers/com.luckymarmot.Paw/Data/Library/Application Support/com.luckymarmot.Paw/Extensions/com.bfgdivision.PawExtensions.LaravelHttpCodeGenerator

Output Examples

Post

$response = \Illuminate\Support\Facades\Http::withToken('full-token-here')->post("https://website.com/api/endpoint", [
    "type" => "transaction",
    "entry" => [
        [
            "resource" => [
                "gender" => "female",
                "address" => [
                    [
                        "use" => "home",
                        "state" => "OK",
                        "city" => "OKC",
                        "country" => "USA",
                        "postalCode" => "73104"
                    ]
                ],
            ]
        ]
    ],
    "resourceType" => "Bundle"
]);

Form requests

$response = \Illuminate\Support\Facades\Http::asForm()->post("https://website.com/connect/token", [
    "client_id" => "abc",
    "client_secret" => "123",
    "scope" => "order_api",
    "grant_type" => "client_credentials"
]);

Basic Auth

$queryString = http_build_query([
    "max" => "25",
    "calendarID" => "3423206",
    "minDate" => "2019-12-01"
]);

$response = \Illuminate\Support\Facades\Http::withBasicAuth('username', 'password')->withHeaders([
    "Cookie" => "PHPSESSID=odf5956n5hgvf17ifbrmolf7f0"
])->get("https://website.com/api/appointments?{$queryString}");

Tests

To run tests:

npm run test

Notes

Modules

Someone more patient and smarter than I can try and figure out how to get actual modules to work with Paw. This package just uses the minified js directly. 🤷🏻‍♂️

External modules that were pulled in directly

jsonar

Regarding jsonar.js, a modification was needed to help with formatting: modification on line 213 to remove ; from return${phpArray};``

About

Laravel Http Request code generator for Paw

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published