-
-
Notifications
You must be signed in to change notification settings - Fork 0
Quick start guide
In this guide we will create a small WebEngine application, add one page, and run it locally with the gt command.
Tip
If you are using WebEngine already, this guide is really a tour of the command-line workflow that the framework expects. The same gt command is how WebEngine exposes serving, building, cron, and migration tasks.
Most often, gt comes from the project itself or from a PHP.GT setup tool that places it on your shell PATH.
If you are working in a Composer project and gt is not available globally, use:
vendor/bin/gt helpThroughout the rest of this guide we will write gt ..., but vendor/bin/gt ... works in the same way.
gt create blog --namespace BlogThis command creates a new directory called blog, asks Composer to install a WebEngine blueprint into it, and then updates the project's dependencies.
If you leave out blog or --namespace Blog, the command will ask for them interactively.
cd blogFrom this point on, gt works against the current project directory.
gt add page aboutThat creates:
page/
├── about.html
└── about.php
The starter files come from this package's built-in templates. The HTML file contains a heading and paragraph, and the PHP file contains an empty go() function ready for page logic.
gt runBy default, this starts the local web server and, where relevant, also starts the build watcher and cron watcher. The default URL is:
http://localhost:8080
Open that address in your browser and then visit /about to see the page you added.
For example:
gt add api status
gt add cron cleanupThat gives you an API endpoint and a cron script scaffold using the same beginner-friendly workflow.
At that point you have the core shape of a PHP.GT command-line workflow: create a project, add files from templates, and run the local development processes through one command.
Next, move on to Adding files with gt add to see how templating and file generation work in more detail.
PHP.GT/GtCommand is the command-line entry point used by PHP.GT/WebEngine.