Static Site Generator
With the native Static package, you can generate a static version of any package and serve the files directly.
The site will be generated in the static/{package} folder, then you can configure the web server to use this folder as root directory.
Command
MW_ENVIRONMENT={environment} bin/magework Static build {package} {baseUrl}
Example
For example, if your application contains a package named Acme and you want to serve it at the URL https://www.example.com:
MW_ENVIRONMENT=default bin/magework Static build Acme https://www.example.com
Configuration
You can create a configuration file in the package to be generated to ignore routes or files.
<?php
// packages/Acme/etc/static.php
$config = [
'static' => [
'ignore_files' => [ // Regex only
'/(.*)README.md$/i',
'/(.*)CHANGELOG.md$/i',
'/(.*)LICENCE$/i',
'/(.*)\.php$/i',
],
'ignore_routes' => [ // Regex only
'/\/secret.html/i',
'/\/secret\/(.*)/i',
],
],
];
- Installation
- Configuration
- Add a new package
- Add a new HTML page
- Serve any type of file
- Rewrite a route
- Add a new block
- Data assignment
- Objects and class fallback
- Database
- Console Commands
- Framework tools
- Custom shared libraries
- External libraries with composer
- Templating best practices
- Forms
- Captcha
- Write content in Markdown
- Static Site Generator