tobya/laravel-mssql-dateformat
Composer 安装命令:
composer require tobya/laravel-mssql-dateformat
包简介
Check and set MSSQL universal date format used by Laravel to 'Ymd' to ensure universal compatibility
README 文档
README
There is an international date format (ISO standard) (YYYY-MM-DD) Y-m-d that is supposed to be universal, however the MSSQL implementation is flawed
and is NOT universal and incorrectly interprets Y-m-d as Y-d-m which is beyond idiotic.
Laravel uses Y-m-d as their international format, which can lead to errors depending on SQL SERVER Settings.
There is one format Ymd which is absolutely gauranteed to always be interpreted by SQLServer as Ymd. This command patches the file in
illuminate library to use Ymd instead of Y-m-d. I Requested that the change be made in the illuminate library but it was felt the change
was too big to be made.
I hope this is helpful to those of you out there using MSSQL with PHP/Laravel.
Installation
Install with composer
composer require tobya/laravel-mssql-dateformat
To Run
Run by calling the larvel command
php artisan mssql:check-universal-date --update
You can run without --update to do the check without patching the file.
Configuration
It is suggested that you add the following to your project composer.json file so this command is automatically run
on install and update.
"scripts": {
"post-update-cmd": [
"@php artisan mssql:check-universal-date --update"
],
"post-install-cmd": [
"@php artisan mssql:check-universal-date --update"
]
}
This is due to the fact that whenever composer update or composer install is run and the illuminate package
is updated it will overwrite the SqlServerGrammar.php with the origional version, so it is necessary to call
the command whenever this has the potential of happening. If no change has been made to the file it will
not be modified.
Further reading on why this is necessary
This is discussed in several places online
tobya/laravel-mssql-dateformat 适用场景与选型建议
tobya/laravel-mssql-dateformat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.02k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tobya/laravel-mssql-dateformat 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tobya/laravel-mssql-dateformat 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-28