tafhyseni/php-multi-tenancy
最新稳定版本:1.0.1
Composer 安装命令:
composer require tafhyseni/php-multi-tenancy
包简介
Handling and managing Multi Tenancy objects
README 文档
README
Simple PHP package to help you control, create and manage Tenancy architectural databases.
Currently this works only on MySQL, but other databases will be added shortly! Also, this does work only on same hostname databases, it will also soon extended to support different hostnames..
Want to contribute.. you're welcome :)
Installation
You can install the package via composer:
composer require tafhyseni/php-multi-tenancy
Initialization
Initialization is simple as long as you do not forget to pass configuration properly
use Tafhyseni\PhpMultiTenancy\Tenancy; $tenancy = new Tenancy( array( 'hostname' => '127.0.0.1', 'username' => 'root', 'password' => '', 'database' => 'test', 'tenancy_hostname' => '127.0.0.1', 'tenancy_username' => 'root', 'tenancy_password' => '' ) );
Usage
Generating an entire tenancy schema with all tables and data
$name = $tenancy->generate(NULL, array(), true);
Generating an entire tenancy schema with only some tables and data
$name = $tenancy->generate(NULL, array('table_to_clone_1', 'table_to_clone_2'), true);
Generating an entire tenancy schema with only some tables, no data and specified tenancy name
$name = $tenancy->generate('my_tenancy_db', array('table_to_clone_1'), data);
Testing
composer require --dev phpunit/phpunit ./vendor/bin/phpunit tests/TenancyTest
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email tafhyseni@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate.
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-08