Skip to content

Releases: jan-made/latte

v0.2.0

Choose a tag to compare

@trejjam trejjam released this 31 Dec 16:53
3df8e78

What's Changed

Bug Fixes

  • Fix DI extension to gracefully handle missing Latte service (#8)
    • Use hasDefinition() instead of getDefinitionByType() to avoid exceptions when Latte service is not registered
    • Follow contributte/vite pattern for safe Latte integration
    • Support both FactoryDefinition (nette/application 3.2+) and ServiceDefinition (older versions)
    • Register TrejjamLatteExtension as a proper DI service (trejjam.latte.extension)
    • Gracefully skip auto-registration when latte.latteFactory is not found
    • Remove unused Latte\Engine import

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/latte

Usage

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\LatteExtension

Or register the Latte extension directly:

latte:
    extensions:
        - Trejjam\Latte\TrejjamLatteExtension

What'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

Choose a tag to compare

@trejjam trejjam released this 31 Dec 09:41
53ee56b

🎉 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 filters
  • DI\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/latte

For 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\LatteExtension

Standalone (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.