Download the PHP package nodir/db-sync without Composer

On this page you can find all versions of the php package nodir/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 db-sync

Laravel DB Sync

PHP Laravel PostgreSQL Docker License

πŸš€ Production PostgreSQL bazasini local muhitga bir buyruq bilan ko'chiring.

Laravel dasturchilari uchun oddiy va xavfsiz vosita β€” prod serverdagi PostgreSQL bazasini SSH orqali local kompyuteringizga sinxronlash. Real ma'lumotlar bilan ishlash, debug qilish va test qilishni osonlashtiradi. Docker va oddiy muhit ikkalasida ham ishlaydi.


✨ Xususiyatlari


πŸ“‹ Talablar

Ishlash uchun quyidagilar kerak:

Component Versiya Qayerda
PHP ^8.1 Local
Laravel 10.x / 11.x / 12.x Local
PostgreSQL client 14+ Local (pg_dump, pg_restore)
PostgreSQL server 14+ Prod server
SSH Har qanday Local β†’ Prod

⚠️ Muhim: Local va Prod'dagi PostgreSQL versiyalari bir xil bo'lishi kerak! Aks holda transaction_timeout kabi versiya-spetsifik xatolar chiqishi mumkin.

Local kompyuterda pg_dump va pg_restore o'rnatilganligini tekshiring:

Agar yo'q bo'lsa, Ubuntu/Debian'da:


πŸ“¦ O'rnatish

O'zingizga mos variantni tanlang:

Oddiy muhit (Docker'siz)

1-qadam: Composer orqali

πŸ’‘ Eslatma: --dev flagi bilan o'rnatilyapti, chunki bu vosita faqat development muhiti uchun.

2-qadam: Config faylni publish qilish (ixtiyoriy)

Sozlamalarni o'zgartirmoqchi bo'lsangiz:

Bu config/db-sync.php faylini yaratadi.


🐳 Docker muhiti

Docker'da ishlash uchun 3 ta qo'shimcha qadam bor: konteynerda pg_dump/pg_restore va SSH client bo'lishi kerak, SSH key'lar konteynerga uzatilishi kerak, va PostgreSQL versiyalari mos kelishi kerak.

1-qadam: Dockerfile'ga dependency qo'shish

Dockerfile'ga postgresql-client va openssh-client qo'shing:

2-qadam: SSH key'larni konteynerga uzatish

docker-compose.yml dagi app service'ga volume qo'shing:

πŸ’‘ :ro = read-only β€” konteyner SSH key'larni o'zgartira olmaydi.

3-qadam: PostgreSQL versiyasini moslashtirish

Bu juda muhim! Local va prod'dagi PostgreSQL versiyasi bir xil bo'lishi kerak.

Prod serverdagi versiyani tekshiring:

Keyin docker-compose.yml dagi PostgreSQL image'ni shunga moslang:

Agar versiyani o'zgartirgan bo'lsangiz, eski volume'ni tozalash kerak:

4-qadam: Composer paketni o'rnatish

5-qadam: SSH known_hosts ga server qo'shish

Birinchi marta "host key verification" xatosi chiqmasligi uchun:

6-qadam: Tekshirish

Docker β€” to'liq docker-compose.yml namunasi

⚠️ Docker'da DB_HOST: .env da DB_HOST=localhost emas, balki PostgreSQL service nomi yozing (masalan, DB_HOST=db). Aks holda pg_restore local bazani topa olmaydi.


βš™οΈ Sozlash

1-qadam: SSH key sozlash

Prod serverga parolsiz kirish uchun SSH key ulanishini sozlang:

Tekshiring β€” parolsiz ishlashi kerak:

2-qadam: .env faylga qo'shish

Laravel loyihangizning .env fayliga quyidagi o'zgaruvchilarni qo'shing:

⚠️ Muhim: .env fayli .gitignore da borligiga ishonch hosil qiling. Prod parollari hech qachon Git'ga tushmasligi kerak!

3-qadam: Prod DB parolini topish

Prod serverdagi Laravel .env faylidan oling:


πŸš€ Foydalanish

Oddiy sync

Barcha ma'lumotlar va schema'ni ko'chirish:

Natija:

Boshqa rejimlar

Buyruq Tavsif
php artisan db:sync-prod To'liq sync (schema + data)
php artisan db:sync-prod --fresh Avval migrate:fresh qiladi, keyin data yuklaydi
php artisan db:sync-prod --data-only Faqat ma'lumotlarni oladi (schema tegilmaydi)
php artisan db:sync-prod --keep-dump Dump faylini o'chirmaydi, storage/app/db-sync/ da saqlaydi

Flaglarni birlashtirish mumkin:


πŸ” Xavfsizlik

Nima qilinadi

Baza Amal Tavsif
Prod βœ… Faqat o'qiladi pg_dump faqat SELECT qiladi, hech narsa o'zgartirmaydi
Local ⚠️ Qayta yoziladi Eski jadvallar o'chadi, prod nusxasi bilan almashtiriladi

Ichki himoyalar

Tavsiyalar

  1. Sensitive data β€” agar prod'da real foydalanuvchi ma'lumotlari bo'lsa, sync'dan keyin anonymizatsiya qiling:

  2. Backup β€” birinchi marta ishlatishdan oldin local bazani backup qiling:

  3. Alohida backup user β€” production'da root o'rniga faqat pg_dump huquqiga ega alohida SSH user yarating.

πŸ› Muammolarni hal qilish

"Permission denied (publickey)"

SSH key to'g'ri sozlanmagan. Qayta sozlang:

"pg_dump: command not found"

Prod serverda PostgreSQL client o'rnatilmagan:

"pg_restore: command not found" (Docker)

Konteyner ichida PostgreSQL client o'rnatilmagan. Dockerfile'ga qo'shing:

Keyin qayta build qiling: docker compose build

"connection to server failed: fe_sendauth: no password supplied"

.env da PROD_DB_PASSWORD yo'q yoki noto'g'ri. Tekshiring:

"unrecognized configuration parameter: transaction_timeout"

Local va prod'dagi PostgreSQL versiyalari farq qiladi. transaction_timeout PostgreSQL 17 da qo'shilgan.

Yechim: Local PostgreSQL'ni prod bilan bir xil versiyaga ko'taring.

Docker'da docker-compose.yml ni o'zgartiring:

Keyin:

"No identities found" (Docker)

SSH key konteynerga uzatilmagan. docker-compose.yml ga volume qo'shing:

Keyin: docker compose restart

"Host key verification failed" (Docker)

Server konteyner ichidagi known_hosts da yo'q:

"pg_restore: error: could not execute query"

Odatda FK (foreign key) ogohlantirishlari, xavfsiz. Agar jiddiy xato bo'lsa, --fresh flagi bilan qayta urinib ko'ring:

Katta bazalarda timeout

.env ga qo'shing:

(7200 soniya = 2 soat)


πŸ“– Ichki ishlash tamoyili

Oddiy muhitda

Docker muhitida

  1. SSH orqali prod serverga ulanadi
  2. Prod'da pg_dump ishga tushadi, natija local'ga stream bilan kelib tushadi
  3. Local'da pg_restore orqali bazaga yoziladi
  4. Sequence'lar avtomatik to'g'rilanadi
  5. Dump fayl tozalanadi

πŸ›£οΈ Yo'l xaritasi

Kelajakda qo'shilishi mumkin bo'lgan xususiyatlar:


🀝 Hissa qo'shish

Pull request'lar xush kelibsiz! Katta o'zgarishlar uchun avval issue oching.

  1. Repository'ni fork qiling
  2. Feature branch yarating (git checkout -b feature/zo-r-narsa)
  3. Commit qiling (git commit -m 'Zo"r narsa qo"shildi')
  4. Push qiling (git push origin feature/zo-r-narsa)
  5. Pull Request oching

πŸ“„ Litsenziya

MIT License - xohlaganingizcha ishlatishingiz mumkin.


πŸ‘¨β€πŸ’» Muallif

Nodir β€” Senior PHP Developer, Uzbekistan


⭐ Loyihaga yordam berish

Agar paket yoqdi va ishingizga yaragan bo'lsa:


Made with ❀️ in Uzbekistan πŸ‡ΊπŸ‡Ώ


All versions of db-sync with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
symfony/process Version ^6.0|^7.0
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 nodir/db-sync contains the following files

Loading the files please wait ...