mwd/marquee
Composer 安装命令:
composer require mwd/marquee
包简介
Entity Framework for MySQL
README 文档
README
Overview
Marquee is a free multi-database abstraction layer and ORM. Its purpose is to allow for universal code patterns while making use of intelligent data sources. Whether you choose to store your data in Redis, MySQL, or even a CSV - 99% of your PHP code remains the same.
Database Support
- Redis: Testing
- MySQL: Alpha / Testing
- SQLite: Planned
- MSSQL: Planned
- CSV: Planned
- JSON: Planned
- PostgreSQL: Planned
- Azure Cosmos DB: Planned
About the Author
My name is Charles Pellens. I am a self-taught software engineer from Michigan. I am passionate about simplifying the web development process through automation and innovation. I have a nack for creating clean, semantic APIs. I believe that code verbosity should not be dependent solely on comments. This project allows for expressive code by making use of simple, understandable, and predictable method and class names while maintaining flexible functionality. I hope you find that my work enables you to quickly get up and going with your next project.
https://charlespellens.me/ | contact@charlespellens.com
Disclaimer: Not Production Ready
While I am very proud of the progress on this project, please do not use it for any mission critical work at this point. This is a work in progress and I invite you to play around with it or make it your own.
Quick Start / Example
<?php include 'vendor/autoload.php'; /** * Library Use Statements */ use Marquee\Core\Connection\MySQLConnection; use Marquee\Data\Entity; use Marquee\Exception\Exception; use Marquee\Schema\Property; /** * PHP Core Use Statements */ use \Generator; /** * Define a sample entity with two string properties: * - username * - password */ class User extends Entity { public function getUsername(): string { return $this->username; } public static function Properties(): Generator { yield Property::string('username')->unique(); yield Property::string('password'); } } $db = new MySQLConnection(MySQLConnection::CreateDsn(DB_HOST, DB_PORT, DB_PASSWORD, DB_USERNAME)); $db->selectDb(DB_NAME); if ($db->tryConnect($e)) { try { /** * Build the user table if it doesn't already exist in the schema */ $table = User::BuildTable($db); if (!$table->exists()) { $table->create(); echo 'Created user table', '<br>'; } /** * Query all users */ $userCount = 0; $users = $db->query(User::class)->limit(10)->get(); echo '<ul>'; while ($user = $users->next()) { echo '<li>', $user, '</li>'; $userCount++; } echo '</ul>'; /** * If we have less than 10 users, insert a new one. */ if ($userCount < 10) { $insert = $db->query(User::class)->create([ 'username' => 'Test ' . uniqid(), 'password' => password_hash('test password', PASSWORD_ARGON2I) ]); if ($user = $insert->next()) { echo 'Created test user'; } } else { /** * Start over if we have 10 users */ $db->query(User::class)->truncate()->next(); echo 'Deleted all users'; } } catch (Exception $e) { echo 'Error: ', $e->getMessage(); } finally { $db->disconnect(); } } else { exit($e->getMessage()); }
mwd/marquee 适用场景与选型建议
mwd/marquee 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mwd/marquee 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mwd/marquee 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Free
- 更新时间: 2021-04-16