PHPackages                             iyogesharma/multi-db - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. iyogesharma/multi-db

ActiveLibrary

iyogesharma/multi-db
====================

v1.0.3(1y ago)0263MITPHPPHP &gt;=7.0.0

Since Jun 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/iYogesharma/mtlti-db)[ Packagist](https://packagist.org/packages/iyogesharma/multi-db)[ RSS](/packages/iyogesharma-multi-db/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (6)Used By (0)

MultiDB
=======

[](#multidb)

### What is this repository for?

[](#what-is-this-repository-for)

- This Repo is created to make creating one main database and multiple client specific database easily.
- It will automatically resolve db connection names using some properties defined in YS\\MultiDB\\Models\\Model Class.
- Model::$cachekey key to search client db name in cache. if set it will auto configure database connection based on this key value from cache. If not itn will connect to default database
- Model::$cronKey Similar to $cacheKey you can set this key from crons jobs to automatically resolve database conection
- Version 1.0

### How do I get set up?

[](#how-do-i-get-set-up)

- Installing

```
    composer require iyogesharma/multi-db

    php artisan vendor:publish --tag=multidb:migrations

    php artisan vendor:publish --tag=multidb:models

    //optional

    php artisan vendor:publish --tag=multidb:config
```

For PgSql
---------

[](#for-pgsql)

- instead of default Illuminate\\Database\\Migrations\\Migration extend YS\\MultiDB\\Migration
- This class contains a static property called $schema which helps in identifying schema name for running migrations with dynamic schema names

### For Example

[](#for-example)

```
```php
