programster/orm-generator
Composer 安装命令:
composer require programster/orm-generator
包简介
This package automates the creation of the table and object files for each of your database tables when you are using the irap/mysql-objects or programster/pgsql-objects package.
关键字:
README 文档
README
This package is here to take the tediousness out of having to create a table and object file for each of your database tables when you are using the programster/mysql-objects or programster/pgsql-objects packages for interfacing with your database.
Install
composer require programster/orm-generator
Usage
Write a small script to load the database setings and specify where the generated files should be put. For example, if you are using MySQL:
$db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $generator = new \Programster\OrmGenerator\MySqlGenerator($db, __DIR__ . '/output'); $generator->run();
Alternatively, if you are using PostgreSQL:
$connString = "host=" . DB_HOST . " dbname=" . DB_NAME . " user=" . DB_USER . " password=" . DB_PASSWORD . " port=" . DB_PORT . " options='--client_encoding=UTF8'"; $db = pg_connect($connString); if ($db == false) { throw new Exception("Failed to initialize database connection."); } $generator = new \Programster\OrmGenerator\PgSqlGenerator($db, __DIR__ . '/output'); $generator->run();
After you execute the script, navigate to that folder and you should see a table and object file for each of your database's tables.
统计信息
- 总下载量: 1.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-31