PHP Classes

How Can PHP Sync a Database Between the Development and a Production Server Using the Package DB Sync: Synchronize databases between environments

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-01-15 (10 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 14 This week: 14All time: 11,441 This week: 3Up
Version License PHP version Categories
database-synchronize 1.0Custom (specified...7Databases, Tools, Systems administration, P...
Description 

Author

This package can synchronize databases between environments.

The package can be installed from the command line using PHP Composer which will generate and output a URL of the Web application.

Users can open the page with the generated URL to run the database synchronization Web application using the database service class.

In Portuguese:

Repositório do projeto para Sincronização de Databases de produção para desenvolvimento

Picture of Celso
Name: Celso <contact>
Classes: 5 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 2x

 

Documentation

Database Sync - by Celso Nery

Maintainer Latest Version Software License Build Quality Score

Multilanguage README

en pt-br

About DB Sync

The DB Sync application was born because the development team needed to transfer data from prod to dev databases. This application drops, creates and transfers data from database-name to database-name_dev, if _dev does not exist, the application will create it.

Requirements

PHP 8.2+

  • Packages
    zip unzip libzip libzip-dev libpq-dev libpng-dev oniguruma-dev git lynx nodejs npm postgresql-client
    
  • PHP Extensions
    php82-bcmath php82-bz2 php82-calendar php82-exif php82-gettext php82-opcache php82-pcntl php82-zip php82-pgsql
    

Installation

This application is available in Github/Gitlab:

git clone [email protected]/celsonery/db-sync.git

or

git clone https://github.com/celsonery/db-sync.git

  • First you must create environment variables
    export PGHOST=<ip-of-postgresql-server>
    export PGUSER=<username-of-postgresql-user>
    export PGPASSWORD=<password-of-postgresql-user>
    
  • Run these commands in the application folder in terminal or command prompt
    composer update
    php artisan key:generate
    php artisan optimize
    php artisan serve
    

> Now you must open your browser in the url shared by above command

How to run in Docker

  • Build a docker image
    docker build -t <image-name>:<image-version> -f docker/dockerfile
    
  • Run the docker container
    docker run -itd --rm \
    --name <container-name> \
    -p <local-port>:8000 \
    -e PGHOST=<ip-of-postgresql-server> \
    -e PGUSER=<user-of-postgresql-user> \
    -e PGPASSWORD=<password-of-postgresql-user-password> \
    <image-name-created-before>
    
    > Now you must open your browser in the http://localhost:8000

To run tests

php artisan test

Generate coverage test reports

XDEBUG_MODE=coverage php artisan test --coverage-html reports/

You can see coverage tests in reports folder

/reports

All changes

Please see CHANGELOG for more details.

Contributing

Thank you for considering contributing to the db sync! The contribution guide can be found in the Contribute documentation.

Security Vulnerabilities

If you discover a security vulnerability within DB Sync, please send an e-mail to Celso Nery via [email protected]. All security vulnerabilities will be promptly addressed.

License

The DB Sync is open-sourced software licensed under the MIT license.


  Files folder image Files (179)  
File Role Description
Files folder image.github (4 files, 1 directory)
Files folder imageapp (4 directories)
Files folder imagebootstrap (2 files)
Files folder imageconfig (10 files)
Files folder imagedatabase (3 directories)
Files folder imagedocker (6 files, 3 directories)
Files folder imagek8s (1 file)
Files folder imagelang (2 directories)
Files folder imagepublic (3 files, 1 directory)
Files folder imagereports (2 files, 7 directories)
Files folder imageresources (3 directories)
Files folder imageroutes (3 files)
Files folder imagetests (1 file, 2 directories)
Accessible without login Plain text file .changelog Data Auxiliary data
Accessible without login Plain text file .dockerignore Data Auxiliary data
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yaml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file artisan Example Example script
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file jsconfig.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file package-lock.json Data Auxiliary data
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file pint.json Data Auxiliary data
Accessible without login Plain text file postcss.config.js Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file README.pt-br.md Doc. Documentation
Accessible without login Plain text file sonar-project.properties Data Auxiliary data
Accessible without login Plain text file tailwind.config.js Data Auxiliary data
Accessible without login Plain text file vite.config.js Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:14
This week:14
All time:11,441
This week:3Up