for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cornford\Backup\Providers;
use Cornford\Backup\BackupFactory;
use Cornford\Backup\Commands\BackupCommandExport;
use Cornford\Backup\Commands\BackupCommandRestore;
use Illuminate\Support\ServiceProvider;
class BackupServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
* Bootstrap the application events.
* @return void
public function boot(): void
$configPath = __DIR__ . '/../../config/config.php';
$this->publishes([$configPath => config_path('backup.php')], 'backup');
}
* Register the service provider.
public function register(): void
$this->mergeConfigFrom($configPath, 'backup');
$this->app->singleton(
'backup',
function ($app) {
$config = array_merge($app['config']->get('database'), $app['config']->get('backup'));
return (new BackupFactory())->build($config);
);
'db.export',
return new BackupCommandExport(new BackupFactory(), $app['config']);
'db.restore',
return new BackupCommandRestore(new BackupFactory(), $app['config']);
$this->commands(
'db.restore'
* Get the services provided by the provider.
* @return string[]
public function provides(): array
return ['backup'];