LaravelLaravel & VueJsVueJs

A Laravel package to log HTTP requests



Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Most of the sites we build for our clients contain some sort of contact form. For those client such forms are potentially critical to their business. Imagine for instance a real estate firm that generates leads with such forms. In most cases we will store the submitted values in the db and mail them out to our client. But what if the database is down? For that case we wanted to have an extra safety net and that’s why we created our new laravel-http-logger package.

The package contains a middleware that, applied to a route, will log the entire request.

// in a routes file

Route::post('/submit-form', function () {
    //
})->middleware(SpatieHttpLoggerMiddlewaresHttpLogger::class);

The package supports some nice options such as filtering out some fields from the request, and you can determine how requests should be logged.

To learn more check out the package on GitHub.

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.


★ READ ALSO ★  Creating a Barebones Phalcon App: A simple step-by-step recipe for beginners




Source link

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close