Download the PHP package toppy/symfony-async-twig-bundle without Composer

On this page you can find all versions of the php package toppy/symfony-async-twig-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-async-twig-bundle

Async Twig Bundle

Read-Only Repository This is a read-only subtree split from the main repository. Please submit issues and pull requests to toppynl/symfony-astro.

Symfony integration bundle for the async Twig rendering stack. This is Layer 3 of the Toppy architecture, providing the bridge between Symfony's service container, request handling, and the framework-agnostic async rendering packages. The bundle auto-configures view models, sets up profiler integration, and provides request-aware context factories for the islands architecture.

Installation

The bundle is auto-registered via Symfony Flex. If not using Flex, add it manually:

Requirements

Quick Start

With zero configuration, the bundle enables core view model functionality:

Create a view model:

Use it in templates:

Architecture

Key Classes

Class Purpose
ToppySymfonyAsyncTwigBundle Bundle class, registers compiler passes
ToppySymfonyAsyncTwigExtension Service registration for all packages
Configuration Bundle configuration schema
ContextFactory Creates ViewContext/RequestContext from Symfony Request
ContextResolver Request-scoped context holder with reset support
ViewModelProfiler Collects timing data for view model resolution
TemplateStreamProfiler Collects template/block streaming events
ViewModelDataCollector Web Profiler panel for view models
StreamingDataCollector Unified timeline for streaming debugging

Compiler Passes

Compiler Pass Purpose
ViewModelDependencyValidationPass Detects circular dependencies at compile time
OpenTelemetryCompilerPass Auto-registers OpenTelemetry profiler when available
TwigYieldModeCompilerPass Enables Twig's use_yield mode for streaming
DisableWebLinkListenerPass Prevents duplicate Link headers with Early Hints
ReplaceTwigDataCollectorPass Wraps Twig collector for streamed response support
ConditionalCompilerPass Wrapper for conditional pass execution

Service Configuration

The bundle auto-configures services via tags:

View models are collected into a ServiceLocator for lazy loading, and the ViewModelManager uses this locator to resolve view models on demand.

Configuration

Bundle Configuration

View Model Registration

View models are automatically discovered and registered when they implement AsyncViewModel:

For view models with dependencies on other view models, implement WithDependencies:

The ViewModelDependencyValidationPass detects circular dependencies at container compile time, failing the build rather than causing runtime errors.

Usage

In Controllers

Return a StreamedResponse with the streaming template renderer:

For non-streaming responses, use standard Twig rendering - view models still resolve in parallel:

In Templates

The view() function retrieves resolved view model data:

Context from Symfony Request

The ContextFactory creates contexts from the current Symfony request:

The ContextResolver is request-scoped and implements ResetInterface for FrankenPHP worker mode:

Profiler Integration

When profiler.enabled is true, the bundle registers data collectors for the Symfony Web Profiler:

Web Debug Toolbar

The toolbar shows:

Profiler Panels

ViewModels Panel (toppy.view_model):

Streaming Panel (toppy.streaming):

HTTP Client Panel (toppy.http_client):

The profilers implement LateDataCollectorInterface because StreamedResponse callbacks execute after kernel.response. Data is collected at kernel.terminate.

Streaming Response with Debug Toolbar

The StreamedResponseWebDebugToolbarListener injects the web debug toolbar into streamed responses by appending the toolbar JS after the stream completes. This preserves streaming benefits while maintaining debugging capabilities.

Cache Layer

Enable stale-while-revalidate caching for view models:

View models can define cache behavior:

Cache Invalidation

When invalidation.enabled is true, an endpoint is available at /_cache/invalidate:

OpenTelemetry Integration

When open-telemetry/api is installed and a TracerInterface is available, the OpenTelemetryCompilerPass automatically decorates the profiler to emit spans for view model resolution.

Early Hints Providers

Implement EarlyHintsProviderInterface to add resources to HTTP 103 Early Hints:

The bundle includes ImportMapEarlyHintsProvider for Symfony AssetMapper integration.

Integration

This bundle sits at the top of the dependency graph:

The bundle consolidates service definitions from all packages:

Testing

Key test areas:

License

Proprietary - see the main repository for license details.


All versions of symfony-async-twig-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
toppy/async-view-model Version ^0.7
toppy/twig-view-model Version ^0.7
symfony/framework-bundle Version ^6.4 || ^7.0 || ^8.0
symfony/twig-bundle Version ^6.4 || ^7.0 || ^8.0
symfony/http-kernel Version ^6.4 || ^7.0 || ^8.0
symfony/http-foundation Version ^6.4 || ^7.0 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.0 || ^8.0
symfony/config Version ^6.4 || ^7.0 || ^8.0
symfony/routing Version ^6.4 || ^7.0 || ^8.0
symfony/event-dispatcher Version ^6.4 || ^7.0 || ^8.0
symfony/lock Version ^6.4 || ^7.0 || ^8.0
symfony/asset Version ^6.4 || ^7.0 || ^8.0
psr/log Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package toppy/symfony-async-twig-bundle contains the following files

Loading the files please wait ...