PHPackages                             daun/laravel-latte - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. daun/laravel-latte

ActiveLibrary[Templating &amp; Views](/categories/templating)

daun/laravel-latte
==================

Use Latte templates in Laravel views

1.3.0(1y ago)41.3k11MITPHPPHP ^8.1CI passing

Since Jan 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/daun/laravel-latte)[ Packagist](https://packagist.org/packages/daun/laravel-latte)[ Docs](https://github.com/daun/laravel-latte)[ RSS](/packages/daun-laravel-latte/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (7)Used By (1)

Laravel Latte
=============

[](#laravel-latte)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cb03818e3a2b8cf5d9d8d5b4e61bf4a2075c060714458be3ba48a8bf60b42932/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461756e2f6c61726176656c2d6c617474652e737667)](https://packagist.org/packages/daun/laravel-latte)[![Test Status](https://camo.githubusercontent.com/7d31da1b1b0dfe7d4ce5368e844b6debd98d3a5ed5eeb433aeb975eff45a27f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461756e2f6c61726176656c2d6c617474652f63692e796d6c3f6c6162656c3d7465737473)](https://github.com/daun/laravel-latte/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/8cea9f0c9e6ddc03f0881d3687e5be782d40ce2b414efd329338cc6563cea08c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6461756e2f6c61726176656c2d6c61747465)](https://app.codecov.io/gh/daun/laravel-latte)[![License](https://camo.githubusercontent.com/94de8af0612f899f30abc047dd136b38132779c6c4aca67552d6e94e69929b5a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6461756e2f6c61726176656c2d6c617474652e737667)](https://github.com/daun/laravel-latte/blob/master/LICENSE)

Add support for the [Latte](https://latte.nette.org) templating engine in [Laravel](https://laravel.com) views.

Features
--------

[](#features)

- Render `.latte` views
- Latte engine configurable via facade
- Translation provider to access localized messages
- Laravel-style path resolution when including partials
- Extensive test coverage

Installation
------------

[](#installation)

```
composer require daun/laravel-latte
```

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 9/10/11

Usage
-----

[](#usage)

Installing the composer package will automatically register a Service Provider with your Laravel app. You can now render Latte files like you would any other view. The example below will render the view at `resources/views/home.latte` using Latte.

```
Route::get('/', function() {
    return view('home');
});
```

Configuration
-------------

[](#configuration)

The package will read its configuration from `config/latte.php`. Use Artisan to publish and customize the default config file:

```
php artisan vendor:publish --provider="Daun\LaravelLatte\ServiceProvider"
```

Localization
------------

[](#localization)

The package includes a custom translator extension that acts as a bridge to Laravel's translation service. It allows using any translations registered in your app to be used in Latte views, using either the `_` tag or the `translate` filter:

```
{_'messages.welcome'}
{('messages.welcome'|translate)}
```

You can pass in parameters as usual:

```
{_'messages.welcome', [name: 'Adam']}
{('messages.welcome'|translate:[name: 'Adam'])}
```

Translate using a custom locale by passing it after or in place of the params:

```
{_'messages.welcome', [name: 'Mary'], 'fr'}
{_'messages.welcome', 'fr'}
```

Pluralization works using the `transChoice` filter.

```
{('messages.apples'|transChoice:5)}
```

Path resolution
---------------

[](#path-resolution)

The package includes a custom loader that allows including partials from subdirectories using Laravel's dot notation to specify folders.

```
{* resolves to /resources/views/partials/slideshow/image.latte *}

{include 'partials.slideshow.image'}
```

To specifically include files relative to the current file, prefix the path with `./` or `../`:

```
{include './image.latte'}
```

Default layout
--------------

[](#default-layout)

If you require a common layout file for all views, you can define a default layout in `config/latte.php`. Any views without a specifically set layout will now be merged into that layout.

```
[
    // /resources/views/layouts/default.latte
    'default_layout' => 'layouts.default'
]
```

Configuring Latte
-----------------

[](#configuring-latte)

### Extensions

[](#extensions)

To extend Latte and add your own tags, filters and functions, you can use the `extensions` array in `config/latte.php` to supply a list of Latte extensions to register automatically.

```
[
    'extensions' => [
        \App\View\Latte\MyExtension::class
    ]
]
```

### Facade

[](#facade)

You can also directly access and configure the Latte engine instance from the `Latte` facade. Modify its config, add custom filters, etc.

```
use Daun\LaravelLatte\Facades\Latte;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Latte::addFilter('plural', fn($str) => Str::plural($str));
    }
}
```

### Events

[](#events)

If you need to be notified when the Latte engine is created, listen for the `LatteEngineCreated`event to receive and customize the returned engine instance.

```
use Daun\LaravelLatte\Events\LatteEngineCreated;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        Event::listen(function (LatteEngineCreated $event) {
            $event->engine->setAutoRefresh(true);
        });
    }
}
```

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance45

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Total

5

Last Release

431d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/31ac2b3787ded290b6bac87b937abf4f267483e4da64731bfb256a942bb669ca?d=identicon)[daun](/maintainers/daun)

---

Top Contributors

[![daun](https://avatars.githubusercontent.com/u/22225348?v=4)](https://github.com/daun "daun (67 commits)")

---

Tags

laravellattetemplate-engineviewlaravelnettetemplatingviewenginelatte

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/daun-laravel-latte/health.svg)

```
[![Health](https://phpackages.com/badges/daun-laravel-latte/health.svg)](https://phpackages.com/packages/daun-laravel-latte)
```

###  Alternatives

[contributte/latte

Extra contrib to nette/latte

111.5M2](/packages/contributte-latte)[itstructure/laravel-grid-view

Grid view for laravel framework

2546.6k2](/packages/itstructure-laravel-grid-view)[latrell/smarty

This package lets you run Smarty3 on Laravel5 elegantly.

127.0k](/packages/latrell-smarty)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
