Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Twig Extensions

Twig Extensions Laravel Package

nucleos/twig-extensions

Nucleos Twig Extensions adds a practical set of Twig filters, functions, and tests for everyday templating. It integrates smoothly with Twig-based PHP projects, helping you keep templates concise, readable, and maintainable without custom extension boilerplate.

View on GitHub
Deep Wiki
Context7

A focused set of Twig extensions for Symfony/PHP projects, adding reusable template helpers that keep presentation logic out of controllers and services. It plugs into Twig’s runtime extension system, making additional filters and functions easy to register, autowire, and use across templates.

  • Extra Twig filters and functions for common formatting tasks
  • Lazy runtime loaders for efficient rendering
  • Clean Symfony integration via service configuration
  • Framework-friendly, reusable helpers for shared templates
  • Simple setup with no application code changes required
Frequently asked questions about Twig Extensions
What is nucleos/twig-extensions used for?
It provides a collection of practical Twig filters, functions, and tests for everyday template work. The goal is to keep views cleaner and more expressive by reusing helpers instead of repeating template logic. It is a PHP package designed to integrate into Twig-based applications.
How do I install nucleos/twig-extensions with Composer?
Install it with Composer using composer require nucleos/twig-extensions. Then register or load the extensions in your Twig environment according to the package documentation. Because it is a PHP library, installation is not tied to a specific framework.
Does nucleos/twig-extensions work with Laravel?
Laravel uses Blade by default, not Twig, so these extensions are not available in Blade templates out of the box. To use them in Laravel you need a Twig integration layer that exposes a Twig environment, then register the Nucleos extensions there. The package itself is framework-agnostic PHP.
Can I use these Twig extensions alongside Blade in Laravel?
They are Twig extensions, so they only apply to Twig templates, not Blade views. You can run Twig alongside Blade if your Laravel app includes a Twig bridge or integration package. The helpers will not be callable from standard Blade files.
What filters, functions, and tests does the package provide?
The package adds a collection of practical Twig filters, functions, and tests intended for common template tasks. The exact list can change between releases, so check the repository README and source for the current helpers. Reviewing the extension classes is the quickest way to confirm what is available in your installed version.
How do I register the Twig extensions in my application?
Registration depends on how your Twig environment is bootstrapped. You typically add the provided extension classes to the Twig environment's extension list. Follow the package README for the supported registration approach and any required service provider or configuration changes.
How can I test templates that use these Twig extensions?
Test them through a Twig environment that has the Nucleos extensions registered, then render templates and assert the output. Keep unit tests focused on the rendered result and any edge cases in your template data. If your app uses a framework integration, mirror that setup in the test bootstrap.
Is nucleos/twig-extensions safe for production use?
It is a lightweight Twig extension library intended for normal template rendering. As with any Composer dependency, review the release notes, pin a tested version, and run your application's test suite before deploying. Check that the helpers you use behave as expected with your production Twig configuration.
What are alternatives to nucleos/twig-extensions?
Alternatives include writing your own Twig extensions, using helpers from your framework's Twig integration, or adopting other Twig extension packages. The best choice depends on which filters, functions, and tests you actually need. If you only need one or two helpers, a small custom extension may be simpler.
How do I check if nucleos/twig-extensions is actively maintained?
Check the repository's release history, commit activity, and open issues on GitHub. Composer metadata and Packagist can also show available versions. Reviewing recent tags helps you judge compatibility with your Twig version.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource