Driver to seamlessly integrate the Backup Manager into Laravel applications.

Related tags

Database laravel
Overview

Laravel Driver for the Database Backup Manager

This package pulls in the framework agnostic Backup Manager and provides seamless integration with Laravel.

Watch a video tour to get an idea what is possible with this package.

Note: This package is for Laravel integration only. For information about the framework-agnostic core package (or the Symfony driver) please see the base package repository.

Table of Contents

Stability Notice

It's stable enough, you'll need to understand filesystem permissions.

This package is being actively developed, and we would like to get feedback to improve it. Please feel free to submit feedback.

Requirements

  • PHP 7.3+
  • Laravel 5.5+
  • MySQL support requires mysqldump and mysql command-line binaries
  • PostgreSQL support requires pg_dump and psql command-line binaries
  • Gzip support requires gzip and gunzip command-line binaries

Installation

Composer

Run the following to include this via Composer

composer require backup-manager/laravel

Then, you'll need to select the appropriate packages for the adapters that you want to use.

# to support s3 or google cs
composer require league/flysystem-aws-s3-v3

# to support dropbox
composer require srmklive/flysystem-dropbox-v2

# to support rackspace
composer require league/flysystem-rackspace

# to support sftp
composer require league/flysystem-sftp

# to support gcs
composer require superbalist/flysystem-google-storage

Laravel 5 Configuration

To install into a Laravel project, first do the composer install then add *ONE *of the following classes to your config/app.php service providers list.

// FOR LARAVEL 5.5 +
BackupManager\Laravel\Laravel55ServiceProvider::class,

Publish the storage configuration file.

php artisan vendor:publish --provider="BackupManager\Laravel\Laravel55ServiceProvider"

The Backup Manager will make use of Laravel's database configuration. But, it won't know about any connections that might be tied to other environments, so it can be best to just list multiple connections in the config/database.php file.

We can also add extra parameters on our backup manager commands by configuring extra params on .env file:

BACKUP_MANAGER_EXTRA_PARAMS="--column-statistics=0 --max-allowed-packet"

Lumen Configuration

To install into a Lumen project, first do the composer install then add the configuration file loader and ONE of the following service providers to your bootstrap/app.php.

// FOR LUMEN 5.5 AND ABOVE
$app->configure('backup-manager');
$app->register(BackupManager\Laravel\Lumen55ServiceProvider::class);

Copy the vendor/backup-manager/laravel/config/backup-manager.php file to config/backup-manager.php and configure it to suit your needs.

IoC Resolution

BackupManager\Manager can be automatically resolved through constructor injection thanks to Laravel's IoC container.

use BackupManager\Manager;

public function __construct(Manager $manager) {
    $this->manager = $manager;
}

It can also be resolved manually from the container.

$manager = App::make(\BackupManager\Manager::class);

Artisan Commands

There are three commands available db:backup, db:restore and db:list.

All will prompt you with simple questions to successfully execute the command.

Example Command for 24hour scheduled cronjob

php artisan db:backup --database=mysql --destination=dropbox --destinationPath=project --timestamp="d-m-Y" --compression=gzip

This command will backup your database to dropbox using mysql and gzip compresion in path /backups/project/DATE.gz (ex: /backups/project/31-7-2015.gz)

Scheduling Backups

It's possible to schedule backups using Laravel's scheduler.

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
 protected function schedule(Schedule $schedule) {
     $environment = config('app.env');
     $schedule->command(
         "db:backup --database=mysql --destination=s3 --destinationPath=/{$environment}/projectname --timestamp="Y_m_d_H_i_s" --compression=gzip"
         )->twiceDaily(13,21);
 }

Contribution Guidelines

We recommend using the vagrant configuration supplied with this package for development and contribution. Simply install VirtualBox, Vagrant, and Ansible then run vagrant up in the root folder. A virtualmachine specifically designed for development of the package will be built and launched for you.

When contributing please consider the following guidelines:

  • please conform to the code style of the project, it's essentially PSR-2 with a few differences.
    1. The NOT operator when next to parenthesis should be surrounded by a single space. if ( ! is_null(...)) {.
    2. Interfaces should NOT be suffixed with Interface, Traits should NOT be suffixed with Trait.
  • All methods and classes must contain docblocks.
  • Ensure that you submit tests that have minimal 100% coverage.
  • When planning a pull-request to add new functionality, it may be wise to submit a proposal to ensure compatibility with the project's goals.

Maintainers

This package is maintained by Shawn McCool and open-source heroes.

License

This package is licensed under the MIT license.

Changelog

2.0

Released on 2020-04-30

Remove support for all Laravel versions below 5.5. All older versions should use the backup-manager ^1.0.

Since so many dependencies in Laravel / Symfony have changed it became impossible to support newer versions in the same code-base. Release ^1.0 is stable and is always accepting new stability fixes (we haven't seen anything to fix in a long time).

Comments
  • Not usable for Laravel 5.2

    Not usable for Laravel 5.2

    I installed a fresh 5.2 version and wanted to install the backup-manager.

    But it requires symfony/process 2.* but Laravel is shipped with 3.*

    Is there any way to use it?

    opened by cre8 14
  • Add support for laravel 7

    Add support for laravel 7

    In this PR, we are adding support for laravel 7. Related to #125.

    How to test

    Backup Manager now requires php ^7.3.

    $ php -v
    PHP 7.4.3 (cli) (built: Feb 23 2020 07:24:02) ( NTS )
    

    Create new laravel project

    $ laravel new backup_manager_test
    

    Add repositories on composer.json

        "repositories": [
            {
                "type": "vcs",
                "url":  "https://github.com/nafiesl/backup-manager-laravel"
            }
        ],
    

    Install the package

    $ composer require backup-manager/laravel dev-laravel_7_support
    

    See if the package successfully installed.

    opened by nafiesl 12
  • Dropbox client not found

    Dropbox client not found

    This package is not working for me:

    composer require srmklive/flysystem-dropbox-v2

    PHP Fatal error: Class 'Dropbox\Client' not found in C:\xampp\htdocs\copytrade\copytrade\vendor\backup-manager\backup-manager\src\Filesystems\DropboxFilesystem.php on line 27

    [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Dropbox\Client' not found

    opened by 4sh3 11
  • [ErrorException]   Declaration of BackupManager\Laravel\Laravel5Compatibility::table()

    [ErrorException] Declaration of BackupManager\Laravel\Laravel5Compatibility::table()

    [ErrorException]
      Declaration of BackupManager\Laravel\Laravel5Compatibility::table() should
      be compatible with Illuminate\Console\Command::table(array $headers, array
      $rows, $style = 'default')
    

    Laravel version: Laravel Framework version 5.0.33

    I intend on upgrading soon. Any work around?

    opened by Kryptonit3-zz 9
  • The helper

    The helper "dialog" is not defined.

    I receive the following error when doing db:list, using the Laravel 5.1+ driver on Laravel 5.2.

    vagrant@homestead:~/Code/Acme$ php artisan db:list These arguments haven't been filled yet: source, path. The following questions will fill these in for you.

    Available sources: local, s3, gcs, rackspace, dropbox, ftp, sftp

    [Symfony\Component\Console\Exception\InvalidArgumentException]
    The helper "dialog" is not defined.

    The Dialog Helper was depreciated in Symfony 2.5 and removed in 3.0, yet the package is configured to require symfony/process version ~2.1||~3.0.

    The same is true for the Table Helper.

    opened by devonzara 8
  • [Question] new tag for PHP7

    [Question] new tag for PHP7

    Hey @ShawnMcCool,

    I am currently using 1.0.*@dev to get this package to install on PHP7 servers.

    I saw that accepted a PR for the composer.json update. Were you planning on tagging or should I continue to use @dev?

    Thanks for your time.

    opened by ninjaparade 8
  • Move extra params definition to backup manager config

    Move extra params definition to backup manager config

    This PR will be a fix for reported error after laravel 6 support. https://github.com/backup-manager/laravel/issues/118#issuecomment-529152723

    BackupManager\ShellProcessing\ShellProcessFailed
    mysqldump: [ERROR] unknown variable 'column-statistics=0'
    

    This fix works for laravel 6 on MySQL 5.7 or MariaDB 10.2.

    Kindly please review this @ShawnMcCool, @mitchellvanw.

    opened by nafiesl 7
  • Fix compatibility with backup-manager v1.1.1

    Fix compatibility with backup-manager v1.1.1

    Fix DbBackupCommand fire function to work with backup-manager v1.1.1.

    The backupProcedure->run function needs an array of Destination object instead of the plain destination and destinationPath since this commit: backup-manager/backup-manager@533c547ccac6627b28c9afbe93527cc576d990b6

    Also fix issue #45.

    opened by NicolasMahe 7
  • fails to run as cron command

    fails to run as cron command

    I have the below command set up for backing up

    db:backup --database=mysql --destination=s3 --destinationPath=date +\test/%Y%m%d%H%M%S.sql--compression=gzip

    Code works fine as command

    Fails with local.ERROR: exception 'BackupManager\ShellProcessing\ShellProcessFailed' with message 'sh: mysqldump: command not found when the same is run from scheduler.

    Any suggestions.

    opened by frozonfreak 6
  • Can not install league/flysystem-aws-s3-v3

    Can not install league/flysystem-aws-s3-v3

    I think the backup-manager/laravel is requiring aws-sdk v2 while league/flysystem-aws-s3-v3 requires aws-sdk v3. This prevents you from installing both.

    opened by jakeryansmith 6
  •   [ErrorException]   Declaration of BackupManager\Laravel\Laravel55Compatibility::table($headers   , $rows, $style = 'default') should be compatible with Illuminate\Console\C   ommand::table($headers, $rows, $tableStyle = 'default', array $columnStyles    = Array)

    [ErrorException] Declaration of BackupManager\Laravel\Laravel55Compatibility::table($headers , $rows, $style = 'default') should be compatible with Illuminate\Console\C ommand::table($headers, $rows, $tableStyle = 'default', array $columnStyles = Array)

    Error on Laravel55Compatibility, please update the solution

    
      [ErrorException]
      Declaration of BackupManager\Laravel\Laravel55Compatibility::table($headers
      , $rows, $style = 'default') should be compatible with Illuminate\Console\C
      ommand::table($headers, $rows, $tableStyle = 'default', array $columnStyles
       = Array)
    
    
    

    Error on composer update:

    Writing lock file
    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postUpdate
    > php artisan optimize
    
    
      [ErrorException]
      Declaration of BackupManager\Laravel\Laravel55Compatibility::table($headers
      , $rows, $style = 'default') should be compatible with Illuminate\Console\C
      ommand::table($headers, $rows, $tableStyle = 'default', array $columnStyles
       = Array)
    
    
    Script php artisan optimize handling the post-update-cmd event returned with error code 1
    
    

    Solution: Change the Laravel55Compatibility.php line 17:

    public function table($headers, $rows, $style = 'default', array $columnStyles = []) {
    
    
    opened by 4sh3 5
  • Error trying to run on Lumen 7.2.2

    Error trying to run on Lumen 7.2.2

    Framework: Lumen 7.2.2 Error: Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given, called in /testapp/ven dor/backup-manager/laravel/src/Lumen55ServiceProvider.php on line 89

    Desciption: Above error occurs when trying to run php artisan.

    opened by GotaloveCode 0
  • Laravel 8 Support and Beyond

    Laravel 8 Support and Beyond

    In this PR, we are adding support for laravel 8.x and beyond. It will work on the upcoming laravel major release as well.

    This PR tested on laravel 8 on this project https://github.com/nafiesl/silsilah/pull/61 (installed successfully, doing backup and restore in MySQL).

    opened by nafiesl 1
  • dropbox not working

    dropbox not working

    I'm testing dropbox backup. Create app, configure in backup-manager.php run: php artisan db:backup --database=mysql --destination=dropbox --destinationPath=project --timestamp="d-m-Y" --compression=gzip

    it seems working: Dumping database and uploading... Successfully dumped mysql, compressed with gzip and store it to dropbox at project03-07-2020

    but no file at app project.

    Where is the fail?

    opened by carlituxman 1
  • Crash when database connection is via socket (so no host)

    Crash when database connection is via socket (so no host)

    It looks like src/GetDatabaseConfig:34 assumes there will be a 'host' index defined in the $connection array, although this will not be the case for a connection via socket vs. TCP/IP.

    This is a bummer because it means if I want backup-manager/laravel installed I am forced to use the higher overhead TCP/IP connection for all of my application, even though the socket connection works fine for the rest of my Laravel app when backup-manager/laravel is not installed.

    opened by brucek2 0
Releases(1.1.1)
Owner
Backup Manager
A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more.
Backup Manager
A package to backup your Laravel app

A modern backup solution for Laravel apps This Laravel package creates a backup of your application. The backup is a zip file that contains all files

Spatie 5.1k Jan 1, 2023
A mysql database backup package for laravel

Laravel Database Backup Package This package will take backup your mysql database automatically via cron job. Installing laravel-backup The recommende

Mahedi Hasan Durjoy 20 Jun 23, 2021
Laravel Thermite is an extended PostgreSQL Laravel database driver to connect to a CockroachDB cluster.

Laravel Thermite Laravel Thermite is an extended PostgreSQL Laravel database driver to connect to a CockroachDB cluster. ?? Supporting If you are usin

Renoki Co. 9 Nov 15, 2022
Oracle DB driver for Laravel 4|5|6|7|8 via OCI8

Oracle DB driver for Laravel 4|5|6|7|8 via OCI8 Laravel-OCI8 Laravel-OCI8 is an Oracle Database Driver package for Laravel. Laravel-OCI8 is an extensi

Arjay Angeles 751 Jan 6, 2023
Laravel 5.1 ODBC Driver

l5-odbc-driver Laravel 5.1 ODBC driver Installation To Install this in your Laravel 5.1 app, open composer.json and add: "require": { "garylocke/odb

Gary Locke 8 Sep 19, 2019
integrate phpmyadmin with laravel

Integrate phpmyadmin in laravel project This package can automatically intergrate phpmyadmin into laravel project,will copy phpmyadmin to public direc

BELHARRADI JAMAL 5 Sep 28, 2021
🔌 A Doctrine DBAL Driver implementation on top of Swoole Coroutine PostgreSQL extension

Swoole Coroutine PostgreSQL Doctrine DBAL Driver A Doctrine\DBAL\Driver implementation on top of Swoole\Coroutine\PostgreSQL. Getting started Install

Leo Cavalcante 19 Nov 25, 2022
Doctrine PHP mapping driver

WORK IN PROGRESS! Doctrine PHP mapping driver Alternative mapping driver that allows to write mappings in PHP. Documentation Associations examples TOD

Andrey Klimenko 3 Aug 15, 2021
A package for using Google Datastore as a database driver

Laravel Eloquent for Google Datastore A package for using Google Datastore as a database driver. By using this package, you can use query builder and

A1 Comms Ltd 3 Apr 26, 2022
A PHP client driver for the RethinkDB query language (ReQL).

PHP-RQL A PHP client driver for the RethinkDB query language (ReQL).

Daniel Mewes 341 Dec 30, 2022
Feather - a highly performant SQLite Cache Driver for Kirby 3

?? Kirby3 SQLite Cache-Driver Feather - a highly performant SQLite Cache Driver for Kirby 3 Commerical Usage Support open source! This plugin is free

Bruno Meilick 1 Dec 15, 2021
SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate.

SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate. NoSQL API

SleekwareDB 12 Dec 11, 2022
[Package] Multi-tenant Database Schema Manager for Laravel

Multi-tenant Database Schema Manager for Laravel Tenanti allow you to manage multi-tenant data schema and migration manager for your Laravel applicati

Orchestra Platform 580 Dec 5, 2022
PHP Object Model Manager for Postgresql

POMM: The PHP Object Model Manager for Postgresql Note This is the 1,x version of Pomm. This package is not maintained anymore, the stable Pomm 2.0 is

Grégoire HUBERT 161 Oct 17, 2022
Satis composer repository manager with a Web UI

Satisfy Satis Composer repository manager with a simple web UI. Introduction Satisfy provides: a Web UI: A CRUD to manage your satis configuration fil

Ludovic Fleury 470 Dec 28, 2022
A drop-in library for certain database functionality in Laravel, that allows for extra features that may never make it into the main project.

Eloquence Eloquence is a package to extend Laravel's base Eloquent models and functionality. It provides a number of utilities and classes to work wit

Kirk Bushell 470 Dec 8, 2022
A Laravel package to output a specific sql to your favourite debugging tool. The supported log output is Laravel Telescope, Laravel Log, Ray, Clockwork, Laravel Debugbar and your browser.

Laravel showsql A Laravel package to output a specific sql to your favourite debugging tool, your browser or your log file. Use case You often want to

Dieter Coopman 196 Dec 28, 2022
This project is about import CSV to Laravel with Laravel Excel library.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Abraham VĂ­ctor Zaragoza RodrĂ­guez 1 Nov 20, 2021
[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)

Illuminate Database The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style OR

The Laravel Components 2.5k Dec 27, 2022