I want to make all requests dynamic rather than defining Http in each function followed by httpMethod like this.
Http::post()
Http::put()
Http::delete()
what i tried.
function send($method, $url) {
Http::withToken($token)->{$method}($url)
}
function x() {
return $this->send('GET', 'url')
}
My code above works fine and i dont know if call a function from variable output like {$method} is best practice. but I want something similar like Guzzle.
(new Client)->request($method, $url, $options)