-
-
Notifications
You must be signed in to change notification settings - Fork 5
What is WebEngine
WebEngine is a static-first PHP toolkit for building web applications with HTML, PHP, and server-side DOM manipulation.
In plain PHP projects it's very easy for one file to end up doing everything at once: read input, run business rules, talk to the database, output HTML, set cookies, redirect the browser, and so on. That is often fine at the start of a project, but once a few pages and features are added it becomes difficult to follow what happens during a request.
WebEngine gives that work a more obvious shape. A page view holds the HTML, a matching page logic file can make it dynamic, and application classes can hold the behaviour that does the real work. The aim is not to hide the web behind lots of abstraction, but to let the structure of the application reflect the structure of the request.
That is why the framework stays close to the web platform. URLs are still important. HTML is still the response. Forms and links still matter. PHP is used where server-side logic is needed, but the page can begin life as a normal static document.
At the centre of WebEngine is the pairing of a page view and page logic. A file such as page/about.html is the page view. If the page needs behaviour, page/about.php can be added beside it. When the browser requests /about, WebEngine routes the request to those files automatically.
Inside the page logic, the page is made dynamic by working with the server-side document object model (DOM) rather than by echoing strings of markup. The page is made dynamic by binding data to the DOM. If you need lower-level control, manual DOM manipulation is available and already feels familiar to web developers.
WebEngine brings together a collection of smaller PHP.GT packages and wires them into one request pipeline. That includes:
- routing and request handling - https://www.php.gt/routing
- page rendering for HTML and API responses - https://www.php.gt/routing and https://www.php.gt/json
- DOM templating and server-side binding - https://www.php.gt/dom and https://www.php.gt/domtemplate
- input, cookies, and sessions - https://www.php.gt/input, https://www.php.gt/cookie and https://www.php.gt/session
- configuration loading - https://www.php.gt/config
- database access - https://www.php.gt/database
- a service container - https://www.php.gt/servicecontainer
- local server and build tooling - https://www.php.gt/server, https://www.php.gt/build
- command line helpers through
gt- https://www.php.gt/gtcommand
Because those parts are maintained as separate projects, the docs often link out when a subject deserves more detail than the WebEngine guide needs to carry.
The overall aim throughout GT repositories is to provide an alternative, minimalistic approach to web development. If you're tired of working with the so-called "full stack", there might be something of interest to you here.
All GT repositories are designed to be inclusive to novice developers. Each repository is designed to operate independently, allowing developers to leverage individual components without necessarily needing to adopt the entire framework or possess prior knowledge of WebEngine. This modular approach not only enhances flexibility but also promotes a more focused, purpose-driven development experience.
WebEngine itself provides a "batteries-included" default configuration and has an accessible entry point for beginners. However, its capabilities extend far beyond basic use-cases; WebEngine is robust enough to power large-scale, real-world applications serving millions of users.
Learn about WebEngine's core principals, or go straight to the quick start.
- File-based routing
- Page views
- Page logic
- Dynamic URIs
- Headers and footers
- Custom HTML components
- Page partials
- Binding data to the DOM
- DOM manipulation
- Hello You tutorial
- Todo list tutorial
- Address book tutorial WIP
- Blueprints
- Application architecture
- Coding styleguide WIP
- PHP environment setup WIP
- Web servers WIP
- Background cron tasks
- Database setup WIP
- Client-side compilation WIP
- Testing WebEngine applications WIP
- Production checklist WIP
- Security WIP