PHPackages                             coderabbi/virtuoso - 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. coderabbi/virtuoso

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

coderabbi/virtuoso
==================

Laravel Composable View Composers Package - Increase flexibility and reduce code duplication by easily composing complex View Composers from simple component Composers without unnecessary indirection or boilerplate code.

v0.9.4(11y ago)671042MITPHPPHP &gt;=5.4.0

Since Jul 2Pushed 8y ago6 watchersCompare

[ Source](https://github.com/coderabbi/virtuoso)[ Packagist](https://packagist.org/packages/coderabbi/virtuoso)[ RSS](/packages/coderabbi-virtuoso/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

[![image](https://camo.githubusercontent.com/187a98636c350938954474e5280d4bebecbed5033bde12aeaf08cc4fd59ab927/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f656d32353361626a636b7772366b342f56697274756f736f2e706e67)](https://camo.githubusercontent.com/187a98636c350938954474e5280d4bebecbed5033bde12aeaf08cc4fd59ab927/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f656d32353361626a636b7772366b342f56697274756f736f2e706e67)

Laravel Virtuoso
================

[](#laravel-virtuoso)

#### Laravel Composable View Composers Package

[](#laravel-composable-view-composers-package)

Increase flexibility and reduce code duplication by easily composing complex View Composers from simple component Composers without unnecessary indirection or boilerplate code.

Background
----------

[](#background)

In many of our projects, the same data is often repeated on multiple pages. This presents the challenge of preparing this data in our Controllers and providing it to our various Views without an undue amount of code repetition. Laravel provides us with the ability to limit this potential repetition through an abstraction known as the View Composer. A View Composer allows you to abstract this code to a single location and make it available to multiple Views. A View Composer is simply a piece of code which is bound to a View and executed whenever that View is requested.

An example View Composer from the Laravel documentation:

```
View::composer('profile', function($view)
{
	$view->with('count', User::count());
}
```

A View Composer may also be created as a Class:

```
