Skip to content
Greg Bowler edited this page Aug 30, 2018 · 41 revisions

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.

General system requirements

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-curl for performing Curl requests
  • ext-json for dealing with JSON data
  • ext-pdo for connecting to databases - see Database setup for more information
  • ext-mysql for connecting to MySQL databases - see Database setup for more information
  • ext-sqlite for connecting to SQLite databases - see Database setup for more information
  • scss for compiling Sass CSS - see SCSS compilation for more information
  • webpack with babel for compiling EcmaScript 6 - see ES6 compilation for more information
  • rsync for organising client-side assets - see Rsync setup for more information

Running locally on Windows, Linux or Mac

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 composer command should be available from your terminal.
  • If Composer is not installed globally, you can download composer.phar into your project directory as described on the Composer download page.
  • Run composer require phpgt/webengine (or ./composer.phar require phpgt/webengine if you have used the Phar option) to download the dependencies into the project's vendor/ directory.
  • Once the dependencies are installed, run ./vendor/bin/gt-serve and place some content within page/index.html to 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/webengine for Unix systems, or C:\etc\php\7.2\php.exe composer.phar require phpgt/webengine On Windows.

Running the PHP inbuilt server yourself

Since the release of PHP 5.4, PHP comes bundled with its own development 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.php

Note that you will still need to perform your own client-side compilation if required.

Compiling client-side assets yourself.

// TODO.

Running from Docker

// TODO.

Running from a Virtual machine

Vagrant

// TODO.

Virtualbox / VMWare / other virtualisation

// TODO: Follow local setup guide, but explain port forwarding, etc.

Clone this wiki locally