jacob-roth/php-helpers
Composer 安装命令:
composer require jacob-roth/php-helpers
包简介
An assortment of PHP scripts and classes that aid in the development of PHP projects
README 文档
README
A library of PHP scripts and classes that aid in the development of PHP projects
All scripts are written for PHP 7.4 | 8.*
List of Helpers
-
UpdateSqlClasses.php-
These scripts are used to create php classes representing your database tables
-
Choose a script from
UpdateSqlClasses/based on which sql implementation you're using-
Supported Implementations
-
MySQL:
/UpdateSqlClasses/mysql/UpdateSqlClasses.php -
SQLite:
/UpdateSqlClasses/sqlite/UpdateSqlClasses.php
-
-
-
See the top section of the script to configure the script's parameters
-
Tun from the root directory of project
php UpdateSqlClasses.php
-
-
PdoWrapper.php-
I wrote this class because I hated copying and pasting the same PDO query & execution code and only needing to change the sql query
-
Initialize the object with your PDO instance, then use this class instead of your PDO
-
SqlExecution is the method you'll use the most (usage examples here)
$PdoWrapperInstance->SqlExecution($sql, $vars, [PDO::FETCH_CLASS, User::class], "fetch"); $PdoWrapperInstance->SqlExecution($sql, [], [PDO::FETCH_COLUMN, 0], "fetchAll");
-
Each
SqlExecution()tries to begin a transaction if one hasn't already been opened. Because of this, you'll need to runSaveChanges()to commit that transaction when you insert into of update your tables$PdoWrapperInstance->SaveChanges();
-
-
Logger.php-
This class helps create a custom log file.
-
Use like
$logger = new Logger("path/to/file.log"); $logger->log("hello world!"); $logger->log("hello world!", LogLevel::Warn);
outputs
[ 2021-09-25 07:18:52 ] [ INFO ] hello world! [ 2021-09-25 07:18:40 ] [ WARN ] hello world!
-
-
Util.php-
DebugPrint()- A wrapper around
print_r()that will output data to the browser in a readable format - Optional string title and stringifies a given value of any type
- Use like
\PhpHelpers\Util::DebugPrint($dataToOutput, "A Label To Describe Data");
- A wrapper around
-
jacob-roth/php-helpers 适用场景与选型建议
jacob-roth/php-helpers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「database」 「helper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jacob-roth/php-helpers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jacob-roth/php-helpers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jacob-roth/php-helpers 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
Datetime helpers for timezone handling
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A Zend Framework module that sets up Monolog for logging in applications.
Library with classes to help you do batch.
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-25