macroactive/laravel-psalm
Composer 安装命令:
composer require macroactive/laravel-psalm
包简介
Psalm integration with Laravel. Do not cover Facades. Relatively simple integration
README 文档
README
Why?
Because we use Laravel and want to have decent Psalm coverage. Yes, we are aware on existence of official integration. But it's bigger and has some generalisations. Our implementation adds some limitations on code but, hopefully, more lightweight and makes better checks. Also, this one is more internal tool still, so lack of documentation and other drawbacks could still present :/ Choice is yours — check both and find what suits better for you.
Limitations
We try to make the code easier for Psalm understanding by introducing these limitations. Idea of them is to decrease amount of magic as much as possible.
- all model requests must start with
Model::query() - don't use facades (we consider this antipattern), only proper constructor/signature DI should be used
- models must have proper notation. Version generated by
ide-helpermust be adjusted - we don't use Eloquent collections and fallbacks to Support Collections at all time
Example of a model
//declare strict, NS and other usages here use Illuminate\Support\Collection; /** * @property int $id … other columns * @property-read Collection|CountryRegion[] $regions * @psalm-property-read Collection<CountryRegion> $regions * * @method self published() */ final class Country extends Model {
You can see Psalm notation for relations/ro-properties here. Also, the method published() is a form of scope annotation.
macroactive/laravel-psalm 适用场景与选型建议
macroactive/laravel-psalm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.96k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 macroactive/laravel-psalm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 macroactive/laravel-psalm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-16