https://github.com/effectra/renova
Effectra\Renova is a PHP package that provides a template rendering and web asset management functionality. It includes a template engine for rendering template files and a web asset management system for generating script and link tags for web assets.
https://github.com/effectra/renova
php template-engine view webencore
Last synced: 10 months ago
JSON representation
Effectra\Renova is a PHP package that provides a template rendering and web asset management functionality. It includes a template engine for rendering template files and a web asset management system for generating script and link tags for web assets.
- Host: GitHub
- URL: https://github.com/effectra/renova
- Owner: effectra
- Created: 2023-06-18T22:12:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T13:24:42.000Z (almost 3 years ago)
- Last Synced: 2025-05-21T16:13:01.825Z (about 1 year ago)
- Topics: php, template-engine, view, webencore
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Effectra\Renova
Effectra\Renova is a PHP package that provides a template rendering and web asset management functionality. It includes a template engine for rendering template files and a web asset management system for generating script and link tags for web assets.
## Installation
You can install the Effectra\Renova package via Composer. Simply run the following command:
```
composer require effectra/renova
```
## Usage
### Template Engine
The template engine allows you to render template files using a template syntax. Here's an example of how to use the template engine:
```php
use Effectra\Renova\TemplateEngine;
$template = new TemplateEngine();
// Render a template file
$content = (new Render(
$path,
$data,
[
['url' => function ($path = '') {
return Request::url() . (string) $path;
}]
],
[
['APP_NAME' => $_ENV['APP_NAME'] ]
],
$this->reader
))->send();
$links = $this->encore->linkTags('app');
$scripts = $this->encore->scriptTags('app');
$content = $this->addLinksAndScripts($content, $links, $scripts);
```
In the example above, we create a new instance of the `TemplateEngine` class indirectly by instantiating the `Render` class. The `Render` class uses the `TemplateEngine` internally for rendering the template file. We pass the necessary arguments to the `Render` constructor, including the template file path, data, template functions, template global variables, and an instance of the `Reader` class.
### Web Asset Management
The web asset management feature allows you to generate script and link tags for web assets managed by Encore. Here's an example of how to use the web asset management:
```php
use Effectra\Renova\WebEncore;
$webEncore = new WebEncore();
// Generate script tags for a specific section
$scriptTags = $webEncore->scriptTags('app');
// Generate link tags for a specific section
$linkTags = $webEncore->linkTags('styles');
```
In the example above, we create a new instance of the `WebEncore` class. We then use the `scriptTags` and `linkTags` methods to generate the script and link tags for the specified sections.
## Contributing
Thank you for considering contributing to the Effectra\Renova package! If you would like to contribute, please follow the guidelines in the [CONTRIBUTING.md](link-to-contributing-md) file.
## License
The Effectra\Renova package is open-source software licensed under the [MIT license](link-to-license-file).