ojenra/laravel-sproc
最新稳定版本:v3.0.2
Composer 安装命令:
composer require ojenra/laravel-sproc
包简介
Laravel Query Builder for handling stored procedure.
README 文档
README
Laravel Query Builder for handling stored procedure.
Installation
You can install the package via composer:
composer require masterei/laravel-sproc
Optionally, you can publish the config file with:
php artisan vendor:publish --tag="sproc-config"
Usage
Import class facade
use Masterei\Sproc\Facades\SP;
execute()
/** * Use this method if you are not expecting any dataset result. * @return void */ SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->execute();
get()
/** * Standard way of retrieving data from stored procedure. * This method accepts a dataset index. The default index is 0. */ SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->get();
first()
/** * Returns first object from an object array. */ SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->first();
all()
/** * Retrieves all dataset result. * Can be chained with first() method. */ SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->all();
fetch()
/** * Use this method to initialize dataset results. * Can be chained with first(), get() or all() method. */ $sp = SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->fetch(); // example $data01 = $sp->get(1); $data02 = $sp->get(2);
getScopeID()
/** * Returns id, ID or first row result generated by the stored procedure. */ SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->getScopeID();
toSql()
/** * Use this method to view generated raw query string. */ SP::call('stored_procedure_name') ->params([ 'Param01' => 'Arg01', 'Param02' => 'Arg02', ]) ->toSql();
hydrate()
/** * Convert plain arrays into collection of models. * Can be chained with first(), get() or all() method. */ SP::hydrate([ "key01" => "value01", "key02" => "value02" ]);
Note
- This package uses Laravel Eloquent Collection meaning that you can freely use its features like groupBy(), sortBy(), map() etc.
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
ojenra/laravel-sproc 适用场景与选型建议
ojenra/laravel-sproc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「masterei」 「laravel-sproc」 「sproc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ojenra/laravel-sproc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ojenra/laravel-sproc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ojenra/laravel-sproc 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-07