PHP code example of zenoware / laravel-sql-dump-validator

1. Go to this page and download the library: Download zenoware/laravel-sql-dump-validator 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/ */

    

zenoware / laravel-sql-dump-validator example snippets


$validatorService->validateSqlDumps($path, $depth, function (SqlDumpFileMetadata $metadata, array $errors) {
    // Handle the validation results
});

class SqlDumpEventSubscriber
{
    public function subscribe($events)
    {
        $events->listen(
            SqlDumpFileOk::class,
            function ($event) {
                Log::info('SqlDumpFileOk event fired', ['metadata' => $event->metadata]);
            }
        );

        $events->listen(
            SqlDumpFileCorrupted::class,
            function ($event) {
                Log::info('SqlDumpFileCorrupted event fired', ['metadata' => $event->metadata, 'errors' => $event->errors]);
            }
        );
    }
}

class EventServiceProvider extends ServiceProvider
{
    // [...]

    protected $subscribe = [
        SqlDumpEventSubscriber::class,
    ];

    // [...]
}
bash
php artisan zenoware:sqldump:validate {path} {--depth=2}
bash
php artisan zenoware:sqldump:validate storage/app/sqldumps
bash
php artisan zenoware:sqldump:validate storage/app/sqldumps --depth=3