PHP code example of laravelldone / db-cleaner
1. Go to this page and download the library: Download laravelldone/db-cleaner 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/ */
laravelldone / db-cleaner example snippets
// Limit to specific tables and columns (empty = scan everything)
'tables' => [
'users' => ['name', 'email'],
'products',
],
// Tables never scanned
'exclude_tables' => ['migrations', 'jobs', 'sessions'],
// Fuzzy duplicate sensitivity (lower = stricter)
'duplicates' => ['fuzzy_threshold' => 2],
// Typo detection similarity (0–100, higher = stricter)
'typos' => ['similarity_threshold' => 85],
use Laravelldone\DbCleaner\Facades\DbCleaner;
$analysis = DbCleaner::scan('users');
$analysis->qualityScore; // 73.4
$analysis->grade; // C
$analysis->totalIssueCount(); // 28
// Preview before touching anything
$actions = DbCleaner::previewClean('users', 'name', 'whitespace');
// Apply (confirm bash
composer vendor:publish --provider="Laravelldone\DbCleaner\DbCleanerServiceProvider"
php artisan migrate
bash
# Scan one table, specific columns
php artisan db-cleaner:scan --table=users --columns=name,email
# View scan history
php artisan db-cleaner:report --table=users --format=json
# Clean types: whitespace | casing | duplicate
php artisan db-cleaner:clean users --column=name --type=casing --dry-run
php artisan db-cleaner:clean users --column=name --type=casing --force