Download the PHP package chamber-orchestra/view-bundle without Composer

On this page you can find all versions of the php package chamber-orchestra/view-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 view-bundle

PHP Composer PHPStan PHP-CS-Fixer Latest Stable Version Total Downloads PHP 8.5+ Symfony 8.0

ChamberOrchestra View Bundle

A Symfony bundle that provides a typed view layer for JSON API responses. Define response shapes as PHP classes, return them from controllers, and let the bundle handle serialization automatically — no manual JsonResponse construction needed.

Built for Symfony 8.0 and PHP 8.5+, the bundle eliminates boilerplate in REST API controllers by introducing view models with automatic property binding, collection mapping, and production-ready cache warming.

Key Features

Requirements

Installation

Enable the bundle in config/bundles.php:

Quick Start

Define a view model that maps properties from a domain object:

Return the view from a controller — the bundle converts it to a JsonResponse automatically:

ViewSubscriber converts any ViewInterface result into a JsonResponse. Non-view results pass through unchanged.

View Types

View Purpose
ResponseView Base response with HTTP status (200) and Content-Type: application/json headers
DataView Wraps any view or array under a "data" key
BindView Maps matching properties from a source object using reflection
IterableView Maps collections via a callback or view class string
KeyValueView Produces associative array output for metadata blocks

BindView Property Binding

BindView uses BindUtils to synchronize properties between source objects and view instances. It handles:

Architecture

Request/Response Flow

  1. SetVersionSubscriber (priority 256) — injects the DI-managed BindUtils instance into BindView via BindView::setBindUtils()
  2. Controller returns a ViewInterface object
  3. ViewSubscriber — detects ViewInterface results, wraps non-ResponseViewInterface in DataView, serializes to JSON via ViewNormalizer

View Auto-Discovery

Views implementing ViewInterface are automatically tagged with chamber_orchestra.view via #[AutoconfigureTag]. The ViewPass compiler pass collects these classes and passes them to cache warmers for pre-computation.

Performance Optimizations

The bundle includes a two-phase optimization strategy for production environments:

Phase 1: Runtime Metadata Caching

Phase 2: Build-Time Cache Warming

Cache Configuration

BindUtils is registered as a DI service with $buildId, $debug, and $shareDir constructor arguments. When APP_DEBUG=false, property accessor caching is enabled with a 24-hour lifetime. SetVersionSubscriber injects the configured instance into BindView on each request.

Warm the cache in production:

This generates build-versioned files in the shared cache directory:

Benchmarks

PHPBench benchmarks are included to measure serialization performance and cache impact:

Benchmark classes: BindUtilsBench, CacheWarmupBench, NormalizationBench.

Development

License

MIT


All versions of view-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
symfony/http-kernel Version 8.0.*
symfony/serializer Version 8.0.*
symfony/property-access Version 8.0.*
symfony/dependency-injection Version 8.0.*
symfony/config Version 8.0.*
doctrine/common Version ^3.5
symfony/framework-bundle Version ^8.0
symfony/runtime Version ^8.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 chamber-orchestra/view-bundle contains the following files

Loading the files please wait ...