hypersistence2-0/hypersistence-laravel
Composer 安装命令:
composer require hypersistence2-0/hypersistence-laravel
包简介
PHP Object Oriented persistence framework to Laravel.
README 文档
README
PHP Object Orented persistence framework.
To use in Laravel 5.4 add the following line in config/app.php -> providers:
Hypersistence\HypersistenceServiceProvider::class,
Hypersistence\Auth\HypersistenceAuthServiceProvider::class,
To create models from database use the command:
php artisan hypersistence:make-models <directory?> {--override}
To create the basic user model for authnetication use this command:
php artisan hypersistence:make-auth
Use doc comment tags for mapping classes with database.
Example:
/** * @table(person) */ class Person extends Hypersistence{ /** * @primaryKey * @column(person_id) */ private $id; /** * Use empty column when the column has the same name that var. * @column() */ private $name; /** * When you have a Many to One relationship use tags as below. * You can use 'lazy' or 'eager'. * @manyToOne(lazy) * @column(city_id) * @itemClass(City) */ private $city; /** * When you have a One to Many relationship use tags as below. * You can use 'lazy' or 'eager'. * @oneToMany(lazy) * @joinColumn(person_id) * @itemClass(Book) */ private $books; /** * When you have a Many to Many relationship use tags as below. * You can use 'lazy' or 'eager'. * @manyToMany(lazy) * @joinColumn(person_id) * @inverseJoinColumn(course_id) * @itemClass(Course) * @joinTable(person_has_course) */ private $courses; public function getId(){ return $this->id; } public function setId($id){ $this->id = $id; } public function getName(){ return $this->name; } public function setName($name){ $this->name = $name; } public function getCity(){ return $this->city; } public function setCity($city){ $this->city = $city; } public function getBooks(){ return $this->books; } public function getCourses(){ return $this->courses; } }
Load Example:
$p = new Person(); $p->setId(1); $p->load(); echo $p->getName();
Save Example:
$p = new Person(); $p->setName('Mateus Fornari'); $city = new City(1); $city->load(); $p->setCity($city); $p->save();
Search Example:
$p = new Person(); $p->setName('Mateus'); $search = $p->search(); $search->orderBy('name', 'asc'); $search->orderBy('city.name', 'desc'); $list = $search->execute();
hypersistence2-0/hypersistence-laravel 适用场景与选型建议
hypersistence2-0/hypersistence-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 50 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「microframework」 「persistence」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hypersistence2-0/hypersistence-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hypersistence2-0/hypersistence-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hypersistence2-0/hypersistence-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
This bundle provides tools to build persistence-agnostic storage layer.
Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.
Kinikit - PHP Application development framework MVC component
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat. Perfect for building REST APIs and small-to-medium PHP applications.
A library providing abstract implementations of various persistence layers based on JSON API relational resource concepts.
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-03