shawnveltman/livewire-3-property-updater
Composer 安装命令:
composer require shawnveltman/livewire-3-property-updater
包简介
A package to update Livewire 2 computed properties to use the Livewire 3 syntax
README 文档
README
In Livewire 2, a computed property "foo" would be defined like this:
public function getFooProperty() { return 'bar'; }
In Livewire 3, the same property would be defined like this:
#[Computed] public function foo() { return 'bar'; }
This package automates that update in your Livewire components folder.
Installation
You can install the package via composer:
composer require --dev shawnveltman/livewire-3-property-updater
You can publish the config file with:
php artisan vendor:publish --tag="livewire-3-property-updater-config"
This is the contents of the published config file:
return [ 'start_directory' => 'app/Livewire', // Defaulting to the app directory, but users can change this. 'disk' => 'base_path', 'method_name_style' => 'snake_case', // StudlyCase or snake_case ];
Two notes on this. First and foremost, the package expects you to have a disk called 'base_path' set up (typically in config/filesystems.php) which points to the base path of the app.
'base_path' => [
'driver' => 'local',
'root' => base_path(),
],
Second - I'm the kind of monster that GREATLY prefers snake_case for method names, so that's the default, but it's easy enough to change it to StudlyCase if that's your preference
Usage for updating computed properties
php artisan shawnveltman:livewire-3-property-updater
Check For Invalid Attempts To Set Property To Null in Livewire 3
In Livewire 3, setting a computed property to null will cause an error. After updating, you might find instances in your code where properties are explicitly set to null. This command automates the process of identifying and updating these instances to use unset instead.
When running this command, it'll scan the Livewire components in your specified directory and look for computed properties being set to null. It will replace these instances with the unset function, preventing potential errors in Livewire 3.
Usage for checking null assignments
php artisan shawnveltman:livewire-null-property-updater
Identify Dispatch Patterns in Livewire
The shawnveltman:dispatch-identifier command scans your Livewire components for specific dispatch patterns. It's especially useful when identifying or refactoring certain dispatch() method usages in Livewire.
The command filters out dispatches with named arguments and presents an output of file paths with the line numbers where the dispatch() method matches the targeted pattern.
Usage for identifying dispatch patterns
php artisan shawnveltman:dispatch-identifier
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
shawnveltman/livewire-3-property-updater 适用场景与选型建议
shawnveltman/livewire-3-property-updater 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 82 次下载、GitHub Stars 达 5, 最近一次更新时间为 2023 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「shawnveltman」 「livewire-3-property-updater」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shawnveltman/livewire-3-property-updater 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shawnveltman/livewire-3-property-updater 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shawnveltman/livewire-3-property-updater 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An OpenAI API wrapper that uses the Laravel Http facade for easier testing
A few helpers to profile your test suite
Alfabank REST API integration
A package to get relevant pieces of your codebase for LLM analysis
This is my package aitestgenerator
Laravel package for Accurate Online API integration.
统计信息
- 总下载量: 82
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 38
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-30