PHP code example of redaelfillali / laravel-secure-model
1. Go to this page and download the library: Download redaelfillali/laravel-secure-model 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/ */
redaelfillali / laravel-secure-model example snippets
use Redaelfillali\LaravelSecureModel\SecureModel;
class Post extends SecureModel
{
// These attributes will be purified on every get and set
protected array $sanitizeAttributes = ['title', 'body', 'excerpt'];
}
$post = new Post();
$post->body = '<p>Hello</p><script>alert("xss")</script>';
// The <script> tag is stripped; safe HTML is preserved.
echo $post->body; // <p>Hello</p>
bash
php artisan vendor:publish --provider="Stevebauman\Purify\PurifyServiceProvider"