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 (3 months ago) RSS 2.0 feedNot enough user ratingsTotal: 8 This week: 1All time: 11,435 This week: 34Up
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 is available for providing paid consulting. Contact The Algoslingers .
Classes: 9 packages by
Country: Ghana Ghana
Age: ???
All time rank: 37455 in Ghana Ghana
Week rank: 44 Up1 in Ghana Ghana Up
Innovation award
Innovation award
Nominee: 5x

Winner: 2x

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:8
This week:1
All time:11,435
This week:34Up
User Comments (1)