PHP Classes

How to Use a Laravel Middleware Security Class to Protect Better Laravel Applications Against Modern Security Attacks Using the Package Laravel Middleman: Improve the security of HTTP request responses

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-21 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 6 All time: 11,411 This week: 55Up
Version License PHP version Categories
laravel_middleman 1.0.0MIT/X Consortium ...7HTTP, Libraries, Security, PHP 7
Description 

Author

This package can improve the security of HTTP request responses.

It provides a middleware class for Laravel applications to add security features by improving the HTTP response headers to requests that Laravel applications receive.

Currently, it can:

- Automatically redirect all HTTP requests to HTTPS to ensure secure communication.

- Add the X-Content-Type-Options: header to prevent MIME-sniffing attacks by enforcing the declared content type.

- Add the X-Frame-Options: header to protect against clickjacking by disallowing showing your website pages in frames.

- Add the X-XSS-Protection: header to activate the browser's built-in XSS protection.

-Add Strict-Transport-Security: header to force all future requests to be made over HTTPS.

- Add the Content-Security-Policy: header to restrict the sources of content access to prevent XSS, clickjacking, and other code injection attacks.

Innovation Award
PHP Programming Innovation award winner
June 2024
Winner
Laravel is a popular PHP framework that many PHP developers use to implement PHP applications.

Laravel supports the concept of middleware classes that can alter the responses to HTTP requests generated by Laravel application components.

This package provides a middleware class that can automatically improve the security protection of Laravel PHP applications against many types of modern security attacks.

Manuel Lemos
Picture of The Algoslingers
  Performance   Level  
Name: The Algoslingers <contact>
Classes: 9 packages by
Country: Ghana Ghana
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

Instructions

First, ensure you have a Laravel project set up. If not, you can create one using Composer:

 composer create-project --prefer-dist laravel/laravel your-project-name

Next, create the middleman class by running the following Artisan command:

php artisan make:middleware Middleman

This command will generate a new middleware class located at:


Now replace the Middleman.php file in the ```app/Http/Middleware/Middleman.php``` directory with the downloaded Middleman.php class file.
Alternatively,
Copy and paste all contents in downloaded Middleman.php to the ```app/Http/Middleware/Middleman.php``` file

To register this middleware, open app/Http/Kernel.php and add the Middleman class to the $middleware array:

protected $middleware = [

// Other middleware
\App\Http\Middleware\Middleman::class,

];

  Files folder image Files (1)  
File Role Description
Plain text file Middleman.php Class Main class file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:6
This week:0
All time:11,411
This week:55Up
User Comments (1)