PHP code example of stevenmaguire / laravel-middleware-csp
1. Go to this page and download the library: Download stevenmaguire/laravel-middleware-csp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stevenmaguire / laravel-middleware-csp example snippets
php
// within app/Http/routes.php
Route::get('gallery', ['middleware' => 'secure.content'], function () {
return 'pictures!';
});
php
// within app/Http/routes.php
Route::get('gallery', ['middleware' => 'secure.content:flickr'], function () {
return 'pictures!';
});
php
// within app/Http/Controllers/GalleryController.php
public function __construct()
{
$this->middleware('secure.content');
}
php
// within app/Http/Controllers/GalleryController.php
public function __construct()
{
$this->middleware('secure.content:google');
}
php
// within app/Http/Controllers/GalleryController.php
public function __construct()
{
$this->middleware('secure.content:google,flickr,my_custom');
}