php-pure
Use when the user asks about PHP without a framework, PSR-7, PSR-15 middleware, PSR-11 containers, PDO prepared statements, Composer autoloading or…
от j4flmao★ 47 звёзд на GitHub
Установить php-pure в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
PHP (Pure/Standard)
Purpose
Build PHP applications without a framework — PSR standards-based architecture, routing, middleware, database access, type-safe with PHP 8.x features, and security-first patterns.
Agent Protocol
Trigger
User request includes: pure PHP, PHP without framework, PHP PSR, PHP routing, PHP middleware, PHP DI, PHP database, PHP 8 attributes, PHP enum.
Input Context
- PHP version (8.1+)
- PSR implementations (PSR-7, PSR-15, PSR-11, PSR-3)
- Database (PDO, Doctrine DBAL, MySQLi)
- Container (PHP-DI, custom)
Output Artifact
Project structure, router class, middleware chain, controller, database repository.
Response Format
Produce artifact directly. No preamble, no postamble, no explanations.
Completion Criteria
- PSR-4 autoloading configured
- PSR-7 request/response handling
- PSR-15 middleware pipeline
- PSR-11 container for DI
- Route matching with attributes or configuration
- PDO with prepared statements
Max Response Length
4096 tokens
Architecture Decision Trees
Micro-framework vs Full Framework vs Pure PHP
| Criterion | Pure PHP (PSR stack) | Micro-framework (Slim) | Full Framework (Laravel) |
|---|---|---|---|
| Control | Complete | High | Framework conventions |
| Setup time | High | Low | Very low |
| Performance | Best | Good | Moderate |
| Learning curve | Steep | Low | Moderate |
| Flexibility | Max | High | Constrained by conventions |
Decision: Full control + performance → Pure PHP. Quick REST API → Slim/Fat-Free. Full features → Laravel/Symfony.
PHP 8 Features for Clean Architecture
| Feature | Use | Benefit |
|---|---|---|
| Attributes | Route definitions, validation, middleware | Declarative metadata without annotations |
| Enums | Status, roles, types | Type-safe constants |
| Readonly properties | DTOs, value objects | Immutability by default |
| Named arguments | Constructor DI | Self-documenting dependencies |
| Match expression | Error mapping, event routing | Exhaustive pattern matching |
| Union types | Multi-type returns | Type-safe polymorphic returns |
| Constructor promotion | DTOs, services | Reduces boilerplate |
Workflow
Step 1: Project Structure
project/
public/
index.php # Entry point
src/
Controllers/
UserController.php
Middleware/
AuthMiddleware.php
CorsMiddleware.php
ErrorHandlerMiddleware.php
Router/
Router.php
Route.php
Request/
Request.php # PSR-7 implementation
Response/
Response.php
Container/
Container.php # PSR-11 implementation
Repository/
UserRepository.php
Service/
UserService.php
Exception/
NotFoundException.php
ValidationException.php
Enum/
UserRole.php
config/
routes.php
services.php
composer.json
Step 2: Composer Setup and PSR-4
{
"name": "app/api",
"require": {
"php": ">=8.1",
"psr/http-message": "^1.0",
"psr/container": "^2.0",
"psr/log": "^3.0"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
}
}
Step 3: Router with PHP 8 Attributes
<?php
// src/Router/Route.php
namespace App\Router;
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Route
{
public function __construct(
public readonly string $method,
public readonly string $path,
) {}
}
// src/Router/Router.php
namespace App\Router;
use App\Exception\NotFoundException;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface;
class Router
{
private array $routes = [];
public function register(string $class): void
{
$reflection = new \ReflectionClass($class);
foreach ($reflection->getMethods() as $method) {
foreach ($method->getAttributes(Route::class) as $attribute) {
$route = $attribute->newInstance();
$this->routes[] = [
'method' => $route->method,
'path' => $route->path,
'class' => $class,
'handler' => $method->getName(),
];
}
}
}
public function dispatch(ServerRequestInterface $request, ContainerInterface $container): mixed
{
$method = $request->getMethod();
$uri = $request->getUri()->getPath();
foreach ($this->routes as $route) {
$params = $this->match($route['method'], $route['path'], $method, $uri);
if ($params !== null) {
$controller = $container->get($route['class']);
return $controller->{$route['handler']}($request, ...$params);
}
}
throw new NotFoundException('Route not found');
}
private function match(string $routeMethod, string $routePath, string $requestMethod, stri
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/php-basics.md
- references/php-database.md
- references/php-modern-practices.md
- references/php-routing.md
- references/php-security.md
- references/psr-standards.md
FAQ
Что делает скилл php-pure?
Use when the user asks about PHP without a framework, PSR-7, PSR-15 middleware, PSR-11 containers, PDO prepared statements, Composer autoloading or declare(strict_types=1). Produces framework-free PHP 8.x code. Not for Laravel (use php-laravel) or Symfony (use symfony-backend).
Как установить скилл php-pure?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл php-pure запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…