Download the PHP package dragon-code/laravel-http-macros without Composer
On this page you can find all versions of the php package dragon-code/laravel-http-macros. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dragon-code/laravel-http-macros
More information about dragon-code/laravel-http-macros
Files in dragon-code/laravel-http-macros
Package laravel-http-macros
Short Description Extending the functionality of the Laravel HTTP client
License MIT
Informations about the package laravel-http-macros
HTTP Macros for Laravel
Installation
To get the latest version of HTTP Macros
, simply require the project using Composer:
Configuration
If desired, you can publish the configuration file using the console command:
If your application already has a config/http.php
file, then you can simply add a new macros
key from the
configuration file to it.
Here you can specify a list of your classes for registering macros.
Macro classes must inherit from the abstract class DragonCode\LaravelHttpMacros\Macros\Macro
.
You can also redefine macro names using an associative array. For example:
Usage
Available Methods
Request
- withLogger
Response
- toData
- toDataCollection
Method Listing
withLogger()
Adds the ability to log HTTP requests and responses.
This method will log HTTP requests and responses.
It is also possible to use your own handler, message formatting and path to the log file. To do this, you need to specify the desired channel name from the log file and define the necessary parameters in it.
For example:
toData()
The class instance will be returned.
Note
If a
from
method exists in a class, then it will be called to construct the object.Compatible with Spatie Laravel Data.
toDataCollection()
The Illuminate\Support\Collection
object or an object inherited from it will be returned.
Note
If a
collect
method exists in a class, then it will be called to construct the collection.Compatible with Spatie Laravel Data.
Generate IDE Helper files
You can generate helper files for the IDE using the console command:
This will help your IDE suggest methods.
License
This package is licensed under the MIT License.
All versions of laravel-http-macros with dependencies
dragon-code/support Version ^6.13
illuminate/http Version ^10.0 || ^11.0 || ^12.0
illuminate/support Version ^10.0 || ^11.0 || ^12.0