HydePHP guide
HydePHP builds a static HTML site from Markdown and Blade. On fortrabbit, the build runs during deployment, and the root path points to the compiled _site folder, so no PHP runs per request.
Static output
Hyde is a static site generator, not a CMS. php hyde build turns Markdown and Blade into plain HTML in the _site folder. PHP runs during the build only, not per request.
The build runs as a build command, and the root path points to _site. The PHP component stays booked, as every environment has one.
Versions
Hyde 2 is the current major and needs PHP 8.2 or newer, so set the PHP version accordingly. Hyde 1 is still installable and has the same build command and the same output folder.
Get ready
Have a local PHP development environment with PHP 8.2 or newer and Composer, plus a git repo to deploy from.
Create an app at fortrabbit
Create a new app and pick HydePHP as software. The software template behind the preset sets the root path, the build commands and the SITE_URL variable described below, so there is less to configure afterwards.
Install locally
$ composer create-project hyde/hyde my-site
$ cd my-site
$ php hyde build
The build writes _site. Serve it with any static server, or run php hyde serve for the realtime compiler while writing.
Keep the compiled site out of the repo
_site is rebuilt on every deployment, so it belongs neither in git nor in the deploy package. Add it to .gitignore in the project root:
# .gitignore
# Composer, installed by the build command
/vendor
# Written by `hyde build` on every deployment
/_site
Deploy
Connect the repo as described in the git deployment intro, then push. Two build commands run in order:
$ composer install --no-dev --prefer-dist --no-interaction --no-ansi --no-progress
$ php hyde build
The root path is _site, so the compiled HTML is what visitors reach.
Set the site URL
Hyde writes relative permalinks unless it knows the address the site is served from, and it skips the sitemap and the RSS feed entirely. Set SITE_URL as an environment variable, including the protocol:
SITE_URL=https://www.my-site.tld
The software template presets this to the environment's main domain. Change it once a custom domain is the primary one, otherwise links keep pointing at the frbit.app address.
SITE_NAME is optional and names the site in the RSS feed and the meta tags.
Writing content
Markdown files in _pages, _posts and _docs become pages, Blade views in resources/views the layout. For the platform it is all code: committed, pushed and compiled during deployment. There is no admin panel and nothing writes to the environment at runtime, so no rsync step and no writable folders to exclude.
What a static site does not need
Hyde needs no MySQL component and no jobs. The smallest plans of PHP, storage, traffic and backups are enough.