Laravel 7.2 Released

Laravel 7.2 Released

The Laravel team released v7.2.0 this week with HTTP client query string support and a new timeout configuration option for the SMTP mail driver.

Let’s check out the new features real quick:

The expectsConfirmation Test Method

ShawnCZek contributed the expectsConfirmation() method on the PendingCommand class used to test artisan commands:

$this->artisan('foo:bar')
    ->expectsConfirmation('Do you want to continue?', 'no')
    ->assertExitCode(1);

The confirmation assertion uses expectsQuestion under the hood, but asserts the actual value from the test. The same above would originally need to be:

$this->artisan('foo:bar')
    ->expectsConfirmation('Do you want to continue?', true)
    ->assertExitCode(1);

SMTP Mail Driver Timeout

Markus Podar contributed a timeout configuration for the SMTP mail driver. The default is 30 seconds. If you want to tweak the default, add a custom timeout configuration in seconds:

'timeout' => 60, // seconds

HTTP Client Query String Support

Irfaq Syed contributed query string support to the Laravel HTTP Client, meaning you can pass a second argument to Http::get():

Here’s an example of how it works:

Http::get('https://example.com/get');
// URL: https://example.com/get

Http::get('https://example.com/get?abc=123');
// URL: https://example.com/get?abc=123

Http::get('https://example.com/get', ['foo' => 'bar']);
// URL: https://example.com/get?foo=bar

Http::get('https://example.com/get', 'foo=bar');
// URL: https://example.com/get?foo=bar

Note that passing query params to get() overrides any present in the URI, so use one or the other. Overriding the defaults is how Guzzle handles this situation as outlined in Pull Request #31996.

You can see the full list of new features and updates below and the whole diff between 7.1.3 and 7.2.0 on GitHub. The full release notes for Laravel 7.x are available in the latest v7 changelog:

v7.2.0

Added

  • Added Illuminate\Testing\PendingCommand::expectsConfirmation() (#31965)
  • Allowed configuring the timeout for the smtp mail driver (#31973)
  • Added Http client query string support (#31996)

Fixed

  • Added missing ramsey/uuid dependency to Illuminate/Queue/composer.json (#31988)
  • Fixed output of component attributes in View (#31994)

Changed

  • Changed cookie helper signature to match CookieFactory (#31974)
  • Publish the form request stub used by RequestMakeCommand (#31962)
  • Handle prefix update on route level prefix (449c80)
  • Ensure SqsQueue queues are only suffixed once (#31925)
  • Added space after component closing tag for the View (#32005)

Filed in: News
Laravel News Partners

Laravel Jobs

Senior Full-Time Laravel Developer (REMOTE)
Remote, ANYWHERE
Vue School
Senior Laravel Developer
Remote, USA & Canada Only
Givecloud
Backend Software Engineer
Remote, USA Only
CommentSold
Backend PHP Developer
Hamburg
ABOUT YOU GmbH
Senior Developer
Remote
Shelterluv

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.