Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Interrupting Applications with Laravel Middleware
Nov 16, 2016 @ 12:13:05

The SitePoint PHP blog has a new tutorial posted showing you how to "interrupt applications with Laravel middleware", adding functionality to your request/response handling in a more automatic and reusable way.

Before we launch into using middleware with Laravel, what is middleware? In general, middleware is software that connects different systems to one another. In Laravel, it’s one of the most well known and robust PHP frameworks that are available for use today, middleware provides a way for you to filter out your HTTP requests and manage those requests. This allows you to dictate how those requests interact with your application.

The use of middleware in Laravel 5 can interrupt requests to your application. [...] Laravel’s middleware can interrupt those requests and then perform various actions such as controlling access and requiring authentication to enter certain areas.

They get into some of the details about middleware, how it "interrupts" your requests and then relate it back to its use in Laravel applications. The tutorial talks about using the "artisan" command line tool to make the middleware and an embedded video from their own Laravel series giving even more detail.

tagged: laravel middleware interrupt framework tutorial screencast

Link: https://www.sitepoint.com/middleware-in-laravel-5/

Steponas Kazakevicius' Blog:
Interruptable file download
Sep 13, 2010 @ 10:06:32

Steponas Kazakevicius has written up a new tutorial about file downloading and, more specifically, making an download tool that can handle interruptions in mid-stream (elegantly).

Have you ever been to a website that offers downloads of stuff? And while you are waiting for the download, there are lots of ads around? Sure you have. I have too. The last day I was downloading stuff. An idea came to my head. Was there a site which required to stay and watch the ads while you are downloading? Didn't see one. Is that technically possible? Sure. I wanted to show how. So I made a small web app for that.

His application (live demo or download available) submits the user upload in the background so that, if the user decides to cancel it, they can at any time and move on immediately.

tagged: tutorial interrupt download background

Link: