No framework knowledge

From dykyi-roman/awesome-claude-code · View interactive version

No framework knowledge is an AI agent skill from the GitHub repository dykyi-roman/awesome-claude-code. Framework-less PHP knowledge base. Provides pure PHP project architecture, DDD integration, PSR-7/PSR-15 HTTP, standalone persistence, DI containers, security (JWT lcobucci/jwt, RBAC middleware, password hashing, CSRF), event system (PSR-14, league/event, domain events, async processing), queue (enq

How to use this skill

Skill file

No-Framework PHP Knowledge Base

Quick reference for building framework-free PHP applications using PSR standards, standalone Composer packages, and Clean Architecture. Covers everything needed to run a production-grade project without Symfony, Laravel, or any full-stack framework.

Core Principles

PSR Compliance

| PSR | Purpose | Recommended Package |

|-----|---------|---------------------|

| PSR-4 | Autoloading | Composer autoloader |

| PSR-7 | HTTP Messages | nyholm/psr7 or guzzlehttp/psr7 |

| PSR-11 | Container Interface | php-di/php-di or league/container |

| PSR-15 | HTTP Handlers & Middleware | relay/relay or custom pipeline |

| PSR-17 | HTTP Factories | nyholm/psr7 (includes factories) |

| PSR-3 | Logging | monolog/monolog |

| PSR-6/PSR-16 | Caching | symfony/cache (standalone) |

Key Advantages

Architecture Stack

public/index.php (Front Controller) → Middleware Pipeline (PSR-15)
  → Presentation (Actions) → Application (Use Cases) → Domain (Entities/VOs)
  → Infrastructure (Repos/Adapters) ← Composer + PSR-4 Autoloading

Quick Checklists

DDD-Compatible Pure PHP Project

Clean Architecture Checks

Common Violations Quick Reference

| Violation | Where to Look | Severity |

|-----------|---------------|----------|

| Missing declare(strict_types=1) | Any PHP file | Critical |

| require / include instead of autoloading | Entry points, legacy files | Critical |

| Global state ($_GET, $_POST, $_SESSION) | Presentation layer | Critical |

| Framework dependency in Domain | src/Domain/**/*.php | Critical |

| Custom ORM instead of using Doctrine/Cycle | src/Infrastructure/**/*.php | Warning |

| No PSR-7 — raw echo / header() calls | public/index.php, controllers | Warning |

| Service Locator in Application layer | src/Application/**/*.php | Warning |

| Missing DI container — manual new chains | Bootstrap files | Warning |

| No middleware pipeline — logic in index.php | public/index.php | Info |

| JWT/session logic in Domain | src/Domain/**/*.php | Critical |

| Queue library in Domain | use Enqueue\\ or use PhpAmqpLib\\ in Domain | Critical |

| Cache/HTTP Client in Domain | CacheInterface or HttpClientInterface in Domain | Critical |

| Missing queue resilience | Workers without retry/error handling | Warning |

PHP 8.4 No-Framework Patterns

PSR-15 Middleware

declare(strict_types=1);

namespace Infrastructure\Http\Middleware;

use Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
use Psr\Http\Server\{MiddlewareInterface, RequestHandlerInterface};

final readonly class CorsMiddleware implements MiddlewareInterface
{
    public function __construct(private string $allowedOrigin = '*') {}

    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $handler->handle($request)
            ->withHeader('Access-Control-Allow-Origin', $this->allowedOrigin)
            ->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
    }
}

Application Service (Use Case)

declare(strict_types=1);

namespace Application\Order\UseCase;

final readonly class PlaceOrderUseCase
{
    public function __construct(
        private OrderRepositoryInterface $orders,
        private EventDispatcherInterface $events,
    ) {}

    public function execute(PlaceOrderCommand $command): OrderId
    {
        $order = Order::create($command->customerId, $command->lines);
        $this->orders->save($order);

        foreach ($order->releaseEvents() as $event) {
            $this->events->dispatch($event);
        }

        return $order->id();
    }
}

Front Controller

declare(strict_types=1);

require dirname(__DIR__) . '/vendor/autoload.php';
Dotenv\Dotenv::createImmutable(dirname(__DIR__))->load();
$container = require dirname(__DIR__) . '/config/container.php';
$container->get(App::class)->run();

References

For detailed information, load these reference files:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.