Skip to content

gabedalmolin/php2go-study

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php2go-study

php2go-study is a study fork of the original php2go framework by Marcos Pont. The purpose of this repository is to study the framework's architecture, request lifecycle, extension model, and historical PHP framework design.

This repository is intended for architectural reading and technical analysis. It is not a production recommendation. Any contemporary operational use would require a deliberate modernization and review process, including security review, dependency review, compatibility verification, tests, static analysis, and operational hardening.

Why This Fork Exists

This fork exists to support source-level study of a classic PHP framework. The focus is on understanding how the framework organizes application bootstrap, request-response flow, MVC coordination, framework internals, and extension points.

The value of the repository is educational and historical: it shows how a full-stack PHP framework can coordinate routing, controller dispatch, filters, events, view rendering, data access, configuration, and reusable components using the conventions and constraints of its period rather than current package conventions.

What Is Being Studied

  • Request lifecycle from front controller to response sending.
  • Front Controller pattern through demo/index.php.
  • Application bootstrap through demo/protected/bootstrap.php.
  • Application creation through Php2Go::createWebApplication.
  • Routing and dispatch through Router, RouterRule, and WebApplication.
  • Controller and action execution through Controller, Action, and ActionInline.
  • Action filters and lifecycle events through ActionFilterChain, Component, and event classes.
  • View rendering, layouts, helpers, widgets, placeholders, and script buffers through View.
  • DAO and ActiveRecord data access through DAO, Db, DbAdapter, and ActiveRecord.
  • Configuration, components, modules, aliases, imports, behaviors, and extensibility.

Repository Structure

  • demo/: example web application, including the front controller, public assets, and protected application code.
  • demo/protected/: demo bootstrap, configuration, controllers, models, views, and layouts.
  • docs/: technical architecture review and study documentation.
  • php2go/: framework source code, including application core, web request handling, routing, controllers, views, data access, authentication, cache, validation, behaviors, and utility components.
  • tests/: standalone PHP scripts that exercise selected framework areas such as models, database access, filters, cache, uploads, locale handling, navigation, and feeds.

Suggested Reading Path

  1. Start with this README.md to understand the repository purpose and scope.
  2. Read the technical architecture review.
  3. Inspect demo/index.php as the web front controller.
  4. Inspect demo/protected/bootstrap.php to see framework loading and application creation.
  5. Follow application creation into php2go/Php2Go.php, php2go/Application.php, and php2go/web/WebApplication.php.
  6. Trace request handling through php2go/router/, php2go/controller/, php2go/action/, and php2go/view/.
  7. Review the demo controller, models, and views under demo/protected/.
  8. Inspect the data layer and cross-cutting components under php2go/db/, php2go/activeRecord/, php2go/auth/, php2go/cache/, php2go/validator/, and php2go/behavior/.

Request Lifecycle Diagram

flowchart TD
    A["HTTP request"] --> B["Front controller: demo/index.php"]
    B --> C["Bootstrap: protected/bootstrap.php"]
    C --> D["Php2Go::createWebApplication"]
    D --> E["Php2Go::app()->run"]
    E --> F["onBeginRequest"]
    F --> G["Router parses request path"]
    G --> H["WebApplication dispatches route"]
    H --> I["Controller resolves action"]
    I --> J["Action filter chain"]
    J --> K["Action business logic"]
    K --> L["Model, DAO, or ActiveRecord access"]
    K --> M["View and layout rendering"]
    L --> M
    M --> N["Response body and headers"]
    N --> O["onEndRequest"]
    O --> P["Response sent"]
Loading

Technical Analysis

The detailed source-level review is available in Technical Architecture Review of php2go.

Modernization Note

The technical analysis discusses modernization considerations that would require careful review before any contemporary operational use, including PHP compatibility, Composer and PSR-style autoloading, security review, automated tests, static analysis, CI, error handling, logging, and dependency review.

The repository should first be understood and documented as it exists. Any modernization effort should be staged, test-backed, and explicit about behavior changes.

Credits and References

Contributors

Languages

  • PHP 86.1%
  • JavaScript 9.1%
  • HTML 3.5%
  • CSS 1.3%