Skip to main content

php-development

Modern PHP programming skill - master PHP 8.x syntax, OOP, type system, and Composer

来源信息

仓库
zekdevs/pi-config
最近来源活动
2026年5月17日 04:55
检测到的 SKILL.md 语言
英语
星标
34
Forks
3

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
php-development
description
Modern PHP programming skill - master PHP 8.x syntax, OOP, type system, and Composer
This skill provides comprehensive training in modern PHP development, from basic syntax to advanced PHP 8.4 features. ## Code Examples ### Beginner: Basic Syntax ```php <?php declare(strict_types=1); // Variables and types $name = 'PHP Developer'; $version = 8.3; // Match expression (PHP 8.0+) $status = match($code) { 200 => 'OK', 404 => 'Not Found', default => 'Unknown', }; ``` ### Intermediate: OOP Patterns ```php <?php declare(strict_types=1); // Constructor property promotion (PHP 8.0+) final readonly class User { public function __construct( public int $id, public string $email, public string $name, ) {} } ``` ### Advanced: PHP 8.4 Features ```php <?php declare(strict_types=1); // Property hooks (PHP 8.4+) class Temperature { public float $celsius { get => $this->celsius; set => $value >= -273.15 ? $value : throw new \InvalidArgumentException(); } public float $fahrenheit { get => $this->celsius * 9/5 + 32; set => $this->celsius = ($value - 32) * 5/9; } } ``` ## Troubleshooting ### Common Issues | Problem | Cause | Solution | |---------|-------|----------| | Type errors | Strict types + wrong type | Check function signature, cast values | | Autoloading failures | PSR-4 mismatch | Verify namespace, run composer dump-autoload | | Deprecated features | Old PHP patterns | Update to modern syntax | ## Quality Metrics | Metric | Target | |--------|--------| | Code example accuracy | 100% | | PHP version correctness | 100% | | PSR-12 compliance | 100% |
在 GitHub 查看