Skip to content

[Preview - Part 2] Basic Framework#1934

Draft
markrandall wants to merge 2 commits into
php:previewfrom
markrandall:preview-framework
Draft

[Preview - Part 2] Basic Framework#1934
markrandall wants to merge 2 commits into
php:previewfrom
markrandall:preview-framework

Conversation

@markrandall

@markrandall markrandall commented Jun 19, 2026

Copy link
Copy Markdown

Builds upon Part 1 - #1931

3 core framework components that are highly cohesive, and interdependent to perform their real-world function, and cannot be meaningfully split up while still providing a high degree of context to understand their interactions.

Build Process

Facilitates creating optimized data for the sake of enormously increased performance vs runtime reflection and data processing.

The "build" logic itself is a a simple executor that auto-detects classes that implement the BuildStep interface, and invokes their static build method, passing in a basic context & logging object. The meat of the build process is contained in those function-specific classes that implement BuildStep.

To invoke build, run php bin/build.php and the compiled data will be generated in var/, to which reading and writing is encapsulated via VarCache.

Coupling: Used by both router and services to provide essential performance improvements vs runtime scanning and reflection.
Dependencies: None

Routing / Request Handling

Decouples the physical path of the .php file from its controller code, allows using placeholders / wildcards within routing URLs instead of needing to create large numbers of template-generated files (as is the case with release announcements) e.g. releases/8_4_1.php.

Uses standard attribute-based #[Route]ing mechanism to detect classes, which are also used by the service layer to register anything with one as a service.

Provides an interop handler that gets called inside of error.php, that boots the necessary request, router, and controller service. If a route is not found it transparently continues onto the rest of the error handling code in error.php.

Coupling: Depends on build step to compile routing paths without incurring significant performance hit. Depends on service layer to instantiate controllers.
Dependencies: Symfony Router

Service Layer

Allows registering classes as services, allows inversion of control (IoC) by autowiring service constructor arguments with other specified services.

Coupling: Depends on build step to compile service definitions, without incurring significant performance hit. Depends on routing layer to bootstrap container and create initial controllers.
Dependencies: Symfony Dependency Injection / Container Interface

…thout having to rely on global-scoped variables.
@markrandall markrandall force-pushed the preview-framework branch 3 times, most recently from e446393 to dbb6e99 Compare June 19, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant