Home - PhpGt/WebEngine GitHub Wiki
Introduction
Web frameworks offer many features, but often come with steep learning curves or imposing rules. The motivation behind WebEngine is the belief that what a framework can offer can be achieved by eliminating code rather than adding more.
The core concept behind WebEngine is that applications start static first, the simplest application consisting of a single file at page/index.html
(see the Hello World tutorial).
A clean separation of concerns is promoted, as described in application architecture, so that the business logic, page logic and any client side code can be written and maintained separately.
When a page is ready to be made dynamic, PHP files can be added with the same name as their HTML counterparts; index.html
is powered by index.php
, about.html
is powered by about.php
, etc. Read more about the relationship between Page View and Page Logic. Dynamic pages are made possible by binding data to the DOM.
Important - The documentation here is written for WebEngine V3 which is currently in pre-release stage. As each repository of PHP.Gt reaches stable release, its functionality will be included in WebEngine, but currently there may be gaps in functionality. Please see the releases section for updates when everything reaches stable release.
Main features
- Binding data to the DOM - Declaratively bind data to the page view, server-side.
- Security - Provides automatically encrypted user input and secures against CSRF.
- Database - Organise and template database queries.
- Protected Globals - Replaces superglobals with object-oriented alternatives.
- Build system - Copies and compiles client-side code automatically without needing to run tasks or "watch" directories.
- gt commands - Create, serve, test, etc. from the command line.
- Blueprints - Start coding new applications from the blueprint of example applications.
Separation of concerns
Each component within a WebEngine application can be developed within its own context, usually within its own file on disk, so that WebEngine can hook everything up and make the magic happen. There is a strong separation of concerns promoted throughout the WebEngine and within applications built upon it.
Separate areas of concern:
- Page View - the representation of a page or template, in HTML.
- Page Logic - the business logic that makes Views dynamic, in PHP.
- Database - the database queries, in SQL.
- API View and Logic - the same concept as Page View/Logic, but for building JSON/XML APIs rather than HTML pages.
- Class - the separate areas of functionality that build up your application's business logic.
- Client side assets - the source code for pages' JavaScript and CSS (or preprocessors).
Getting started
If you're new to WebEngine, read the quick start guide first, and work through the beginner tutorials (Hello, World! and Hello, You!) to get the best introduction to the toolkit.
The core concepts to know are detailed in the "User guide", starting with the request-response lifecycle.
Help & Support
Use Stack Overflow to get help with technical issues. Tag your question with webengine
and a developer will be alerted to answer your question as soon as possible.
Report bugs and suggest features on the Github issue tracker.