LARAVEL VERSION 10.42 - GLOBAL DEFAULTS FOR THE HTTP CLIENT, A MAX VALIDATION RULE FOR PASSWORDS AND MORE

  • January 27, 2024

    LARAVEL VERSION 10.42 - GLOBAL DEFAULTS FOR THE HTTP CLIENT, A MAX VALIDATION RULE FOR PASSWORDS AND MORE

    Global Default Options for the HTTP Client

    The ability to configure global default options for the HTTP client via a service provider:

    Http::globalOptions([
    'timeout' => 5,
    'connect_timeout' => 2,
    ]);

    If you call the globalOptions method more than once, it will override the original global configuration on subsequent calls.

    String Unwrap Helper

    Str::unwrap() method which you can use to unwrap strings:

    // Unquote
    Str::unwrap('"Unquote"''"');
    // `Unquote`

    // some: "json"
    Str::unwrap('{ some: "json" }''{''}');
    // ` some: "json" `

    Add Multiple Channels/Routes to at Once

    The ability to configure multiple routes at once for on-demand notifications:

    NotificationFacade::routes([
            
    'mail' => ['info@test.local' => 'Test Customer'],
    'vonage' => '+916352410935',
    ])->notify(new OrderStatusChanged($order));

    New JobQueueing Event

    A JobQueueing event to the framework that is fired before a job is sent to the queue provider. Here’s a rough example of where this event is instantiated, which includes the $connectionName$job, and $payload:

    use Illuminate\Queue\Events\JobQueueing;

    new JobQueueing($this->connectionName, $job, $payload));

    Max Validation Rule for Passwords

    Max length validation rule to the Password rule object. This is useful when defining a default password rule:

    // Before
    Password::min(8)->rules('max:32');

    // New max() method
    Password::min(8)->max(32);

    Comments

WhatsApp