Token导航 LogoToken导航

Agent Skill · 研究检索

php(PHP 搜索)

php 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

php 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 42,577。

总安装 1,058周安装 45GitHub Stars 公开资料未说明下载 371核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:php(PHP 搜索)
来源仓库:https://github.com/vapvarun/claude-backup
仓库路径:skills/php
安装命令:
npx skills add https://github.com/vapvarun/claude-backup --skill php
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/vapvarun/claude-backup --skill php

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找 PHP 语言相关的技术资料或最佳实践。适合在 Codex、Claude、Cursor、Gemini CLI 中检索语法或框架信息。可通过 npx 命令从 claude-backup 仓库安装。建议结合原始 README 核验具体查询范围。注意知识时效性与官方文档同步情况。

php 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/php

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/vapvarun/claude-backup --skill php;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

php 怎么安装?

在终端执行 npx skills add https://github.com/vapvarun/claude-backup --skill php。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

php 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

php 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

php 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

php 用的人多吗?

公开数据是累计安装 1,058 次,近一周安装 45 次,下载 371 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

php 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
php

PHP 搜索 · 本页

1,058—需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

PHP Development

Modern PHP 8.x development patterns and best practices.

PHP 8.x Features

Constructor Property Promotion

// Before PHP 8
class User {
    private string $name;
    private int $age;

    public function __construct(string $name, int $age) {
        $this->name = $name;
        $this->age = $age;
    }
}

// PHP 8+
class User {
    public function __construct(
        private string $name,
        private int $age,
        private bool $active = true
    ) {}
}

Named Arguments

function createUser(string $name, string $email, bool $admin = false): User {
    // ...
}

// Named arguments (order doesn't matter)
createUser(email: 'john@example.com', name: 'John', admin: true);

Match Expression

// BAD: Switch with many breaks
switch ($status) {
    case 'pending':
        $color = 'yellow';
        break;
    case 'approved':
        $color = 'green';
        break;
    default:
        $color = 'gray';
}

// GOOD: Match expression
$color = match($status) {
    'pending' => 'yellow',
    'approved', 'published' => 'green',
    'rejected' => 'red',
    default => 'gray',
};

Null Safe Operator

// Before
$country = null;
if ($user !== null && $user->getAddress() !== null) {
    $country = $user->getAddress()->getCountry();
}

// PHP 8+
$country = $user?->getAddress()?->getCountry();

Union Types & Intersection Types

// Union types
function process(int|float|string $value): int|float {
    return is_string($value) ? strlen($value) : $value * 2;
}

// Intersection types (PHP 8.1+)
function save(Countable&Iterator $items): void {
    foreach ($items as $item) {
        // ...
    }
}

Enums (PHP 8.1+)

enum Status: string {
    case Draft = 'draft';
    case Published = 'published';
    case Archived = 'archived';

    public function label(): string {
        return match($this) {
            self::Draft => 'Draft',
            self::Published => 'Published',
            self::Archived => 'Archived',
        };
    }

    public function color(): string {
        return match($this) {
            self::Draft => 'gray',
            self::Published => 'green',
            self::Archived => 'red',
        };
    }
}

// Usage
$post->status = Status::Published;
echo $post->status->label(); // "Published"

Readonly Properties (PHP 8.1+)

class User {
    public function __construct(
        public readonly int $id,
        public readonly string $email,
        private string $password
    ) {}
}

$user = new User(1, 'john@example.com', 'hashed');
$user->id = 2; // Error: Cannot modify readonly property

Type Safety

Strict Types

<?php
declare(strict_types=1);

function add(int $a, int $b): int {
    return $a + $b;
}

add(1, 2);     // OK
add('1', '2'); // TypeError

Return Types

class UserRepository {
    public function find(int $id): ?User {
        // Returns User or null
    }

    public function findOrFail(int $id): User {
        return $this->find($id) ?? throw new NotFoundException();
    }

    public function all(): array {
        // Returns array of Users
    }

    public function save(User $user): void {
        // Returns nothing
    }

    public function delete(User $user): never {
        // Never returns (throws or exits)
        throw new NotImplementedException();
    }
}

OOP Patterns

Dependency Injection

// BAD: Hard dependency
class OrderService {
    private $mailer;

    public function __construct() {
        $this->mailer = new SmtpMailer(); // Hard to test
    }
}

// GOOD: Dependency injection
interface MailerInterface {
    public function send(string $to, string $subject, string $body): void;
}

class OrderService {
    public function __construct(
        private MailerInterface $mailer,
        private LoggerInterface $logger
    ) {}

    public function complete(Order $order): void {
        $this->mailer->send($order->email, 'Order Complete', '...');
        $this->logger->info('Order completed', ['id' => $order->id]);
    }
}

Value Objects

final class Email {
    private function __construct(
        private readonly string $value
    ) {}

    public static function fromString(string $email): self {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new InvalidArgumentException('Invalid email');
        }
        return new self(strtolower($email));
    }

    public function toString(): string {
        return $this->value;
    }

    public function equals(self $other): bool {
        return $this->value === $other->value;
    }
}

// Usage
$email = Email::fromString('John@Example.com');
echo $email->toString(); // "john@example.com"

Repository Pattern

interface UserRepositoryInterface {
    public function find(int $id): ?User;
    public function findByEmail(string $email): ?User;
    public function save(User $user): void;
    public function delete(User $user): void;
}

class DatabaseUserRepository implements UserRepositoryInterface {
    public function __construct(
        private PDO $pdo
    ) {}

    public function find(int $id): ?User {
        $stmt = $this->pdo->prepare('SELECT * FROM users WHERE id = ?');
        $stmt->execute([$id]);
        $row = $stmt->fetch(PDO::FETCH_ASSOC);
        return $row ? $this->hydrate($row) : null;
    }

    private function hydrate(array $data): User {
        return new User(
            id: $data['id'],
            email: $data['email'],
            name: $data['name']
        );
    }
}

Error Handling

Custom Exceptions

class DomainException extends Exception {}
class ValidationException extends DomainException {}
class NotFoundException extends DomainException {}

class InsufficientFundsException extends DomainException {
    public function __construct(
        public readonly float $balance,
        public readonly float $required
    ) {
        parent::__construct(
            "Insufficient funds: have {$balance}, need {$required}"
        );
    }
}

// Usage
throw new InsufficientFundsException(balance: 50.00, required: 100.00);

Try-Catch Best Practices

// BAD: Catching generic Exception
try {
    $result = $service->process($data);
} catch (Exception $e) {
    log($e->getMessage());
}

// GOOD: Specific exception handling
try {
    $result = $service->process($data);
} catch (ValidationException $e) {
    return response()->json(['errors' => $e->getErrors()], 422);
} catch (NotFoundException $e) {
    return response()->json(['error' => 'Not found'], 404);
} catch (Throwable $e) {
    $this->logger->error('Unexpected error', ['exception' => $e]);
    return response()->json(['error' => 'Server error'], 500);
}

Security

Input Validation

// Always validate and sanitize input
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$age = filter_input(INPUT_POST, 'age', FILTER_VALIDATE_INT, [
    'options' => ['min_range' => 0, 'max_range' => 150]
]);

if ($email === false || $email === null) {
    throw new ValidationException('Invalid email');
}

Password Hashing

// Always use password_hash/password_verify
$hash = password_hash($password, PASSWORD_DEFAULT);

if (password_verify($inputPassword, $storedHash)) {
    // Password correct

    // Rehash if needed (algorithm upgrade)
    if (password_needs_rehash($storedHash, PASSWORD_DEFAULT)) {
        $newHash = password_hash($inputPassword, PASSWORD_DEFAULT);
        $user->updatePassword($newHash);
    }
}

SQL Injection Prevention

// BAD: Direct concatenation
$sql = "SELECT * FROM users WHERE email = '$email'"; // VULNERABLE

// GOOD: Prepared statements
$stmt = $pdo->prepare('SELECT * FROM users WHERE email = ?');
$stmt->execute([$email]);

// GOOD: Named parameters
$stmt = $pdo->prepare('SELECT * FROM users WHERE email = :email AND status = :status');
$stmt->execute(['email' => $email, 'status' => 'active']);

Testing

PHPUnit

class UserServiceTest extends TestCase {
    private UserService $service;
    private MockObject $repository;

    protected function setUp(): void {
        $this->repository = $this->createMock(UserRepositoryInterface::class);
        $this->service = new UserService($this->repository);
    }

    public function testFindUserReturnsUser(): void {
        $expected = new User(1, 'john@example.com');
        $this->repository
            ->expects($this->once())
            ->method('find')
            ->with(1)
            ->willReturn($expected);

        $result = $this->service->find(1);

        $this->assertEquals($expected, $result);
    }

    public function testFindUserThrowsWhenNotFound(): void {
        $this->repository
            ->method('find')
            ->willReturn(null);

        $this->expectException(NotFoundException::class);

        $this->service->findOrFail(999);
    }
}

Data Providers

#[DataProvider('validEmailProvider')]
public function testValidEmails(string $email): void {
    $result = Email::fromString($email);
    $this->assertInstanceOf(Email::class, $result);
}

public static function validEmailProvider(): array {
    return [
        'simple' => ['test@example.com'],
        'with subdomain' => ['test@mail.example.com'],
        'with plus' => ['test+label@example.com'],
    ];
}

Performance

Opcache

; php.ini
opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0  ; Production only

Array Functions

// Use array functions instead of loops when possible
$names = array_map(fn($user) => $user->name, $users);
$adults = array_filter($users, fn($user) => $user->age >= 18);
$total = array_reduce($orders, fn($sum, $order) => $sum + $order->total, 0);

// Generators for large datasets
function readLargeFile(string $path): Generator {
    $handle = fopen($path, 'r');
    while (($line = fgets($handle)) !== false) {
        yield trim($line);
    }
    fclose($handle);
}

foreach (readLargeFile('huge.csv') as $line) {
    // Process one line at a time, low memory
}

Composer Best Practices

{
    "require": {
        "php": "^8.2",
        "monolog/monolog": "^3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^10.0",
        "phpstan/phpstan": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "config": {
        "sort-packages": true,
        "optimize-autoloader": true
    }
}
# Production deployment
composer install --no-dev --optimize-autoloader --classmap-authoritative

平台分布

Claude Code

32%
按下载量换算119

Gemini CLI

23.2%
按下载量换算86

Antigravity

17.01%
按下载量换算63

OpenCode

12.27%
按下载量换算46

Codex

8.4%
按下载量换算31

windsurf

3.5%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills