{"id":16466557,"url":"https://github.com/juborajnaofel/multidb-tenancy","last_synced_at":"2025-02-27T19:38:32.780Z","repository":{"id":219907333,"uuid":"750234093","full_name":"juborajnaofel/multidb-tenancy","owner":"juborajnaofel","description":"This repository provides a lightweight, raw PHP implementation for multi-tenancy support in web applications. It offers a flexible approach for managing multiple databases, allowing each tenant to have its own isolated database schema while sharing the same codebase.","archived":false,"fork":false,"pushed_at":"2024-02-02T14:53:18.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T17:18:11.142Z","etag":null,"topics":["database","multi","multi-tenancy","mysql","php","tenancy"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juborajnaofel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-30T08:47:58.000Z","updated_at":"2024-12-03T05:29:15.000Z","dependencies_parsed_at":"2024-02-02T15:44:13.189Z","dependency_job_id":"3306df90-a86f-4844-b8c3-0e7c4a3332d7","html_url":"https://github.com/juborajnaofel/multidb-tenancy","commit_stats":null,"previous_names":["juborajnaofel/multidb-tenancy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juborajnaofel%2Fmultidb-tenancy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juborajnaofel%2Fmultidb-tenancy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juborajnaofel%2Fmultidb-tenancy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juborajnaofel%2Fmultidb-tenancy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juborajnaofel","download_url":"https://codeload.github.com/juborajnaofel/multidb-tenancy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241051529,"owners_count":19900846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","multi","multi-tenancy","mysql","php","tenancy"],"created_at":"2024-10-11T11:44:05.200Z","updated_at":"2025-02-27T19:38:32.739Z","avatar_url":"https://github.com/juborajnaofel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# multidb-tenancy\n\nconfig database and domains in ./config/config.php\n```php\n$dbConfig = [\n\t\"DB_CONNECTION\" =\u003e \"mysql\",\n\t\"DB_HOST\"=\u003e\"127.0.0.1\",\n\t\"DB_PORT\"=\u003e3306,\n\t\"DB_DATABASE\"=\u003e\"testtenancy\",\n\t\"DB_USERNAME\"=\u003e\"root\",\n\t\"DB_PASSWORD\"=\u003e \"\",\n];\n\n$domainConfig = [\n\t\"APP_URL\" =\u003e '',\n\t\"CENTRAL_DOMAIN\" =\u003e ''\n];\n```\n\naccess current subdomain in index.php\n```php\n$subdomain = $tenancy-\u003ecurrentSubdomain();\n```\n\ncreate a tenant in index.php\n```php\n$tenancy-\u003ecreateTenant($dbConfig['DB_DATABASE'].'_'.$subdomain);\n```\n\nswitch to tenant database in index.php\n```php\n$db-\u003eswitchTenant($dbConfig['DB_DATABASE'].'_'.$subdomain);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuborajnaofel%2Fmultidb-tenancy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuborajnaofel%2Fmultidb-tenancy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuborajnaofel%2Fmultidb-tenancy/lists"}