aniket
aniket

Aniket Magadum

@aniket

PHP Laravel Web Developer

41 Posts 496 Views

  • No matching results...
  • Searching...

/ 255

Hey Laravel Developers

Until now, Laravel can generate temporary URLs to access any of the files available on the S3 storage.

This URL contains an expiry timestamp and a signature for protecting the file

Starting with Laravel v11.23.0, this option is also available for the local driver.

So, you can finally remove any workaround you might have written to achieve this functionality.

image

65

Hey Laravel Developers

One of the common concerns raised against PHP is that it does not handle concurrency due to its single-threaded nature.

This is true, but as Laravel developers, we can execute concurrent tasks within an ongoing request using the new Concurrency Facade.

Under the hood, this facade executes each task as a separate server process using console commands, which is a workaround for PHP's limitation.

I recommend using this facade only for minor tasks because it is still in beta.

For advanced use cases, you can structure your application to use Queues for concurrency.

image

72

Hey Laravel Developers

Out of all the features released recently (post Laracon US), one of my favourites is the defer() function.

The defer() function, as the name suggests, allows us to defer (postpone, in simple terms) the execution of a function or closure after the response is sent back to the client.

This is useful for minor operations that need to be performed in the background, where defining a Queue Job might be too much—for example, sending notifications.

Also, one cool thing that the defer() function does is that it verifies the response status code (2xx) to ensure it's successful before executing the closure.

image

59

Hey Laravel Developers

Starting from Laravel v11.23.0, a new "Skip Middleware" is available for Queue Jobs.

This skip middleware is useful when you want to skip/delete a job based on specific conditions.

It also helps keep your job's core business logic separate from other concerns.

The middleware comes with two methods, when() and unless(), to define the skipping logic.

Here is an example code of how this can be useful

image

43