nrawe/wabi-orm
Composer 安装命令:
composer require nrawe/wabi-orm
包简介
A minimalist, (near) zero-config object-relational mapper
README 文档
README
WabiORM is a minimalist, (near) zero-config object-relational mapper.
Rationale
"Wabi" is a term borrowed from Japanese asethetics which loosely translates as "deliberately simple in daily living". This is something I miss when working with databases in PHP.
Don't get me wrong, there are some great libraries like Doctrine and Eloquent written to solve this problem and all credit to their authors for the fantastic work they've put in.
However, in probably 80% of what I want to do, they're less simple than I'd like. Additionally, from working with more functional programming ideas in the React/JavaScript world, I find myself wanting some of those characteristics on the server.
Lastly, I caught the train during the MicroPHP years and still look back at that period fondly. The desire for minimalism and focus on the 80% requirement stands in direct contrast to the monoliths, as good as they are, which surround us today.
In all, this is my attempt to find joy in database usage again, and maybe it will bring that to you, too. Or not ¯_(ツ)_/¯
@Glance
<?php use function WabiORM\{ belongs_to, connect, delete, find_one, has_many, global_read, global_write, mysql, save }; $connect = connect(mysql($host, $db, $user, $pwd)); global_read($connect); global_write($connect); class User { public $id; public function posts() { return has_many(Post::class, $this); } } class Post { public $id; public $user_id; public $title; public $content; public function user() { return belongs_to(User::class, $this); } } $newPost = new Post(); $newPost->title = 'My first post'; $newPost->content = 'WabiORM put the fun back into database usage!'; $id = save($newPost); $post = find_one(Post::class, $id); $post->title = 'My first post (edited!)'; save($post); delete($post); $user = find_one(User::class, 1); foreach ($user->posts() as $post) { echo $post->title, PHP_EOL; }
Features
- PDO connection middleware
- Works with plain classes
- Simple, powerful query templates
Install
Installation is handled via Composer:
$ composer require nrawe/wabi-orm
Test
The library ships with a test suite, see specs, which can be run by:
$ composer test
Documentation
This section documents the advanced usage.
Roadmap
See ROADMAP.md for details of the planned work.
License
MIT.
nrawe/wabi-orm 适用场景与选型建议
nrawe/wabi-orm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「micro」 「functional」 「microphp」 「functional-programming」 「active-record」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nrawe/wabi-orm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nrawe/wabi-orm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nrawe/wabi-orm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Connection 'Db' codeception module to 'Yii2' module database settings
Kinikit - PHP Application development framework MVC component
Functional library for php with proper currying
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Iteration tools for PHP
Anax htmlform module.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-13