[Preview - Part 2] Basic Framework#1934
Draft
markrandall wants to merge 2 commits into
Draft
Conversation
…thout having to rely on global-scoped variables.
e446393 to
dbb6e99
Compare
dbb6e99 to
6521819
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
BuildStepinterface, and invokes their staticbuildmethod, passing in a basic context & logging object. The meat of the build process is contained in those function-specific classes that implementBuildStep.To invoke build, run
php bin/build.phpand the compiled data will be generated invar/, to which reading and writing is encapsulated viaVarCache.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