Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/norberttech/static-content-generator-bundle
Generate static html pages from your symfony application
https://github.com/norberttech/static-content-generator-bundle
Last synced: 6 days ago
JSON representation
Generate static html pages from your symfony application
- Host: GitHub
- URL: https://github.com/norberttech/static-content-generator-bundle
- Owner: norberttech
- Created: 2020-07-12T09:55:18.000Z (over 4 years ago)
- Default Branch: 1.x
- Last Pushed: 2024-02-10T20:25:57.000Z (9 months ago)
- Last Synced: 2024-09-14T09:23:49.065Z (about 2 months ago)
- Language: PHP
- Size: 7.71 MB
- Stars: 33
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Symfony Static Content Generator Bundle
![Tests](https://github.com/norberttech/static-content-generator-bundle/workflows/Tests/badge.svg?branch=1.x)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg)](https://php.net/)
[![Minimum Symfony Version](https://img.shields.io/badge/Symfony-%3E%3D%204.4-f5c542.svg)](https://php.net/)Generate static html pages from all Symfony routes available in your system.
### Installation
```bash
composer require norberttech/static-content-generator-bundle
```### Configuration
```php
['all' => true],
];
``````yaml
# static_content_generator.yamlstatic_content_generator:
output_directory: "%kernel.project_dir%/output"
```### Usage
Transform all routes into static html pages.
```bash
bin/console static-content-generator:generate:routes
```Options:
* `--parallel=4` - generate static content in parallel using 4 sub processes at once
* `--clean` - clean output path before start
* `--filter-route` - generate content only for given routes
* `--filter-route-prefix` - generate content for routes with given prefix
* `--exclude-route` - generate content for all routes except given
* `--exclude-route-prefix` - generate content for all routes except those with given prefixCopy all assets from `public` directory into output directory
```bash
bin/console static-content-generator:copy:assets
```#### Parametrized Routes
In order to dump parametrized routes you need to register service that implements `SourceProvider` interface
which will return all possible combinations of parameters for given route you would like to dump.Don't forget that this services must have `static_content_generator.source_provider` tag.
```yaml
# service.yamlservices:
FixtureProject\Source\ParametrizedSourceProvider:
tags: ['static_content_generator.source_provider']```
Controller:
```php
render('parametrized.html.twig', ['param1' => $param1, 'param2' => $param2]);
}
}
```Provider:
```php
'first-param', 'param2' => 'second-param']),
];
}
}
```This will generate `/output/parametrized/first-param/second-param/index.hmtml`
### Testing
```php
php -S localhost:8000 -t output
```