-
-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
The recommended installation technique is to use Composer to globally install PHP.Gt and run a local development server. This approach is described in the quick start section.
However, this technique may not be possible or preferable to all developers, so this section will explain how to install different environments for WebEngine development.
Composer's autoloader is required to load all the classes of WebEngine and your application, but can be utilised without global installation of Composer or PHP.Gt. Follow the guide for your particular platform to get developing.
The system requirements to run a WebEngine application are very minimal: PHP 7.2 with ext-xml installed. All other requirements will be managed by Composer automatically.
With the basic system ready, WebEngine applications can be served. However, to fully utilise WebEngine there are more system requirements that will need to be installed prior to use:
-
ext-curlfor performing Curl requests -
ext-jsonfor dealing with JSON data -
ext-pdofor connecting to databases - see Database setup for more information -
ext-mysqlfor connecting to MySQL databases - see Database setup for more information -
ext-sqlitefor connecting to SQLite databases - see Database setup for more information -
scssfor compiling Sass CSS - see SCSS compilation for more information -
webpackwithbabelfor compiling EcmaScript 6 - see ES6 compilation for more information -
rsyncfor organising client-side assets - see Rsync setup for more information
To serve your application, compile your client-side files and run your tests, you can use the gt-commands from the terminal. If PHP.Gt is installed globally, these are available from the gt command, but if global installation isn't possible for you, you can still run them from within your project's vendor/bin directory.
First of all, your project needs to download WebEngine using Composer:
- If Composer is installed globally, the
composercommand should be available from your terminal. - If Composer is not installed globally, you can download
composer.pharinto your project directory as described on the Composer download page. - Run
composer require phpgt/webengine(or./composer.phar require phpgt/webengineif you have used the Phar option) to download the dependencies into the project'svendor/directory. - Once the dependencies are installed, run
./vendor/bin/gt-serveand place some content withinpage/index.htmlto validate that you can view the file on http://localhost:8080.
Once you have a working installation, you can run the other gt commands to manage your project, in isolation from other software on your computer.
PHP.Gt requires a modern PHP 7 interpreter to run. If you have a clashing version of PHP installed already, you can install and pass a different interpreter to composer. For example:
/usr/bin/php-7.2/php composer.phar require phpgt/webenginefor Unix systems, orC:\etc\php\7.2\php.exe composer.phar require phpgt/webengineOn Windows.
Since the release of PHP 5.4, [PHP comes bundled with its own development server][php-inbuilt-server], which can be run with the php -S flag.
The request response lifecycle of WebEngine applications start at the webserver level and are all routed through the go.php script. For security, a nested www/ directory is required as the document root. Therefore, PHP's inbuilt server can be used to serve your WebEngine application with the following command:
php -S 0.0.0.0:8080 -t www/ vendor/phpgt/webengine/go.phpNote that you will still need to perform your own client-side compilation if required.
// TODO.
// TODO.
// TODO.
// TODO: Follow local setup guide, but explain port forwarding, etc.
- 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