PHP code example of blaspsoft / blasp

1. Go to this page and download the library: Download blaspsoft/blasp 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/ */

    

blaspsoft / blasp example snippets


use Blaspsoft\Blasp\Facades\Blasp;

$sentence = 'This is a fucking shit sentence';
$check = Blasp::check($sentence);

$sentence = 'This is a fucking shit sentence';
$blasp = Blasp::check($sentence);

$blasp->getSourceString();       // "This is a fucking shit sentence"
$blasp->getCleanString();        // "This is a ******* **** sentence"
$blasp->hasProfanity();       // true
$blasp->getProfanitiesCount();   // 2
$blasp->getUniqueProfanitiesFound(); // ['fucking', 'shit']

$request->merge(['sentence' => 'This is f u c k 1 n g awesome!']);

$validated = $request->validate([
    'sentence' => ['blasp_check'],
]);

// If the sentence contains profanities, validation will fail.
bash
php artisan vendor:publish --tag="blasp-config"