Repository navigation
Releases: jan-made/latte
Releases · jan-made/latte
Release list
v0.2.0
What's Changed
Bug Fixes
- Fix DI extension to gracefully handle missing Latte service (#8)
- Use
hasDefinition()instead ofgetDefinitionByType()to avoid exceptions when Latte service is not registered - Follow
contributte/vitepattern for safe Latte integration - Support both
FactoryDefinition(nette/application 3.2+) andServiceDefinition(older versions) - Register
TrejjamLatteExtensionas a proper DI service (trejjam.latte.extension) - Gracefully skip auto-registration when
latte.latteFactoryis not found - Remove unused
Latte\Engineimport
- Use
Previous Changes (v0.1.0 → v0.2.0)
- Add Nette DI extension for automatic registration (#7)
- Add comprehensive nette/tester test suite with snapshot verification (#4)
- 37 test cases (15 unit + 22 integration tests)
- Snapshot testing for rendered output
- Refactor json filter to use variadic parameters with named arguments
- Add nepada/phpstan-nette-tester for better static analysis
- Update branch alias for v0.2.x development
- Bump actions/cache from 4 to 5 (#5)
- Bump actions/checkout from 4 to 6 (#6)
Compatibility
- PHP: 8.2, 8.3, 8.4, 8.5
- Latte: 3.0.20+
- Nette DI: 3.2+
- Nette Utils: 4.0+
Installation
composer require trejjam/latteUsage
Automatic Registration (Recommended)
With Composer auto-discovery, the extension is automatically registered. Just install and use:
{* JSON filter *}
{$data|json}
{$data|json:'pretty'}
{$data|json:'pretty','ascii'}
{* Hash filters *}
{$email|md5}
{$password|sha1}Manual Configuration
If auto-discovery is disabled:
extensions:
trejjam.latte: Trejjam\Latte\DI\LatteExtensionOr register the Latte extension directly:
latte:
extensions:
- Trejjam\Latte\TrejjamLatteExtensionWhat's Next
- Future configuration options for filter behavior
- Additional utility filters based on community feedback
Full Changelog: v0.1.0...v0.2.0
v0.1.0 - Initial Release
🎉 Initial Release
Features
- Nette DI Extension: Automatic Latte extension registration via DI container
- Composer Auto-Discovery: Zero-configuration setup - just
composer require trejjam/latte - JSON Filter: HTML-safe encoding with options (pretty, ascii, forceObjects)
- Hash Filters: MD5 and SHA1 hash generation
- Latte 3 Compatible: Built with Latte 3 Extension API
Components
TrejjamLatteExtension: Latte 3 extension providing filtersDI\LatteExtension: Nette DI CompilerExtension for automatic registration- Comprehensive test suite with 41 test cases
- PHPStan level max compliance
- ECS code style enforcement
Installation
composer require trejjam/latteFor Nette users with DI container - that's it! The extension is automatically registered via Composer auto-discovery.
Requirements
- PHP 8.2, 8.3, 8.4, or 8.5
- Latte 3.0.20 or higher
- Nette DI 3.2 or higher
- Nette Utils 4.0 or higher
Configuration
Automatic (recommended):
composer require trejjam/latte
# Extension auto-registered, ready to use!Manual DI extension:
extensions:
trejjam.latte: Trejjam\Latte\DI\LatteExtensionStandalone (without DI):
$latte = new Latte\Engine();
$latte->addExtension(new Trejjam\Latte\TrejjamLatteExtension());Available Filters
|json - JSON encoding with options
{$data|json} {* HTML-safe, unicode-friendly *}
{$data|json:'pretty'} {* Pretty-printed *}
{$data|json:'pretty','ascii'} {* Pretty + ASCII-safe *}
{$data|json:'!html'} {* Disable HTML-safety *}|md5 - MD5 hash
{$email|md5} {* For Gravatar URLs, etc. *}|sha1 - SHA1 hash
{$password|sha1} {* Simple checksums *}Documentation
See README.md for full documentation.
License
MIT License - see LICENSE file.