-
-
Notifications
You must be signed in to change notification settings - Fork 6
Hello You tutorial
This tutorial will start at the point the Hello World tutorial left off: with a single HTML page outputting the traditional phrase "Hello, World!". The Hello World tutorial's completed code is hosted at http://github.com/BrightFlair/hello-world-tutorial.
Pages that consist of HTML source (or other markup) are called Page Views, and strictly contain no PHP code.
Code that executes in context of a page is called Page Logic. To add Logic to a View, create a PHP script with the same name as the View. The contents of the Logic script is a class definition with at least one method, go()
.
The go()
method is called before the page is rendered and allows you to interact with the page via PHP and execute your required logic, calling other classes and functions where required.
The Page Logic's namespace is the Page directory prefixed with your application's namespace (by default, "App
"). See below for an example.
Namespaces must be PSR-4 compliant.
The boilerplate Page Logic class for the index
page looks like this:
src/page/index.php
<?php
namespace App\Page;
class Index extends \Gt\Page\Logic {
public function go() {
// Your page logic here.
}
}#
Website | Packagist | CircleCI | Scrutinizer
- Request-response lifecycle
- Running your application
- Project layout
- Application architecture
- Web servers
- URIs
- Page view
- Dynamic URIs and pages
- Headers and footers
- Page logic
- Protected globals
- User input
- Cookies
- Sessions
- DOM manipulation
- Custom HTML components
- DOM templates
- Binding data to the DOM
- Database
- Client side assets
- API Webservices
- Security
- Configuration
- Build system
- Coding styleguide