Download the PHP package khaleejinfotech/laravel-db-sync without Composer

On this page you can find all versions of the php package khaleejinfotech/laravel-db-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-db-sync

Laravel Db Sync

Laravel DB Sync

Introduction

Sync remote database to a local database or vice-versa

Note this requires remote MySQL connection to sync the database, and that need to be defined in database.php

Install

Install the package.
Note: This extension works in Laravel 8 and above.

Config

You can publish the config file with:

Database Connections

Set the remote database credentials in your config/database.php file

Observing records

To observe changes in records and to sync with remote/local database you must use Syncable to your model, by default this package uses its own observer, but you can replace it with your own having the same code of this observer and your custom logics.

You can replace the observer class from the config/laravel-db-sync.php file.

Note: observer method will only be triggered on eloquent model.

Ignoring models

You can also create a base model with use Syncable and can extend your child models, in this case if you ever wanted to ignore a certain model(s) you can ignore them by specifying in the config/laravel-db-sync.php file like this:

Defining targets/remote server(s).

After setting up connections in the config/database.php file you must have to add connection names where the data has to be synced.

Note: Please specify only remote connections here else it may cause data duplication or may fall into an error.

Handling file uploads of a model

If a model handle files then in the configuration file the columns of the model should be defined so that the files can be synced to the local/remote servers.

Events

Event Description
NoTargetDefined Fired when no remote database defined in config config/laravel-db-sync.php file.
SyncSuccess Fired when each job successfully processed.
SyncFailed Fired when a job is not processed successfully.
SyncUploadSuccess Fired when a file upload job successfully processed.
SyncUploadFailed Fired when a file upload job is not processed successfully.

Commands

Command Description
sync:table Creates migration file.
sync:local Creates jobs for local database records to be synced on remote.
sync:remote Creates jobs for remote database records to be synced on local.

Usage

To sync local database to remote by running:

This will create job for each record that need to be synced.

After that you need run the queue

To sync remote database to local by running:

This will create job for each record that need to be synced.

After that you need run the queue

Suggestion: configure scheduler for above commands to automate synchronization.


All versions of laravel-db-sync with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package khaleejinfotech/laravel-db-sync contains the following files

Loading the files please wait ....