Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lewinmuz's avatar

How to sync offline based database with an online database of the same app.

Scenario: An online based Laravel System is also suppose to be accessed by users who are in a NO INTERNET ZONE, though sometimes they go online. So when they go online all the offline data should be synced with the online data.

The offline version of the app is locally hosted on a local server at a location.

0 likes
1 reply
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

The best way to sync an offline database with an online database is to use a synchronization tool. There are many tools available that can help you sync your databases, such as Flyway, Liquibase, and SymmetricDS.

Flyway is a database migration tool that allows you to keep track of changes to your database and sync them between your online and offline databases. It also allows you to rollback changes if needed.

Liquibase is a database version control tool that allows you to track changes to your database and sync them between your online and offline databases. It also allows you to rollback changes if needed.

SymmetricDS is a data synchronization tool that allows you to sync data between your online and offline databases. It also allows you to set up triggers to sync data when changes are made.

Once you have chosen a synchronization tool, you will need to set up the connection between your online and offline databases. This will involve setting up a connection string and configuring the synchronization tool to use the connection string.

Once the connection is set up, you can configure the synchronization tool to sync data between your online and offline databases. Depending on the tool you choose, you may be able to set up triggers to sync data when changes are made.

// Example code for setting up a connection string with Flyway

flyway.url=jdbc:mysql://localhost:3306/my_database
flyway.user=my_user
flyway.password=my_password
2 likes

Please or to participate in this conversation.