PHPackages                             orchestra/asset - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. orchestra/asset

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

orchestra/asset
===============

Asset Component for Orchestra Platform

v6.1.0(5y ago)52177.4k↓40.6%14[1 issues](https://github.com/orchestral/asset/issues)[1 PRs](https://github.com/orchestral/asset/pulls)4MITPHPPHP ^7.3 || ^8.0

Since Jun 19Pushed 1y ago4 watchersCompare

[ Source](https://github.com/orchestral/asset)[ Packagist](https://packagist.org/packages/orchestra/asset)[ Docs](http://orchestraplatform.com/docs/latest/components/asset/)[ Fund](https://paypal.me/crynobone)[ Fund](https://liberapay.com/crynobone)[ RSS](/packages/orchestra-asset/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (35)Used By (4)

Asset Component for Orchestra Platform
======================================

[](#asset-component-for-orchestra-platform)

Asset Component is a port of Laravel 3 Asset for Orchestra Platform. The component main functionality is to allow asset declaration to be handle dynamically and asset dependencies can be resolve directly from the container. It however is not intended to becoma an asset pipeline package for Laravel, for such purpose we would recommend to use Grunt or Gulp.

[![tests](https://github.com/orchestral/asset/workflows/tests/badge.svg?branch=6.x)](https://github.com/orchestral/asset/actions?query=workflow%3Atests+branch%3A6.x)[![Latest Stable Version](https://camo.githubusercontent.com/4ad1e803b1f911490ce8d4b29e5049fbe5af5b240990c1f05ec34d8c558bacd0/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f61737365742f76657273696f6e)](https://packagist.org/packages/orchestra/asset)[![Total Downloads](https://camo.githubusercontent.com/d81e68928e2a10be810c88fcf77a1167477d11a2b89ef8d227a430eaa93feedb/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f61737365742f646f776e6c6f616473)](https://packagist.org/packages/orchestra/asset)[![Latest Unstable Version](https://camo.githubusercontent.com/a476e69053de700ec33ed99eb8f2eefe3b1010489d1033a58e33f8b2f76e9d00/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f61737365742f762f756e737461626c65)](//packagist.org/packages/orchestra/asset)[![License](https://camo.githubusercontent.com/7ee65cc6387b240f335867a63100b94217d9700e21b7e1c79ea1af16699425a7/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f61737365742f6c6963656e7365)](https://packagist.org/packages/orchestra/asset)[![Coverage Status](https://camo.githubusercontent.com/3c92eaf3abfbbe4c305a9f380777e30d51aba5e6eadb7dacb1259bfcf5eb5bf0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f72636865737472616c2f61737365742f62616467652e7376673f6272616e63683d362e78)](https://coveralls.io/github/orchestral/asset?branch=6.x)

Table of Content
----------------

[](#table-of-content)

- [Version Compatibility](#version-compatibility)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Registering Assets](#registering-assets)
    - [Dumping Assets](#dumping-assets)
    - [Asset Dependencies](#asset-dependencies)
    - [Asset Containers](#asset-containers)
    - [Asset Versioning](#asset-versioning)
- [Changelog](https://github.com/orchestral/asset/releases)

Version Compatibility
---------------------

[](#version-compatibility)

LaravelAsset5.5.x3.5.x5.6.x3.6.x5.7.x3.7.x5.8.x3.8.x6.x4.x7.x5.x8.x6.xInstallation
------------

[](#installation)

To install through composer, run the following command from terminal:

```
composer require "orchestra/asset"

```

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

[](#configuration)

Add following service providers in `config/app.php`.

```
'providers' => [

    // ...

    Orchestra\Asset\AssetServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,

],
```

### Aliases

[](#aliases)

You might want to add `Orchestra\Support\Facades\Asset` to class aliases in `config/app.php`:

```
'aliases' => [

    // ...

    'Asset' => Orchestra\Support\Facades\Asset::class,

],
```

Usage
-----

[](#usage)

### Registering Assets

[](#registering-assets)

The Asset class provides a simple way to manage the CSS and JavaScript used by your application. To register an asset just call the add method on the Asset class:

#### Registering an asset:

[](#registering-an-asset)

```
Asset::add('jquery', 'js/jquery.js');
```

The add method accepts three parameters. The first is the name of the asset, the second is the path to the asset relative to the public directory, and the third is a list of asset dependencies (more on that later). Notice that we did not tell the method if we were registering JavaScript or CSS. The add method will use the file extension to determine the type of file we are registering.

### Dumping Assets

[](#dumping-assets)

When you are ready to place the links to the registered assets on your view, you may use the styles or scripts methods:

Dumping assets into a view:

```

    {!! Asset::styles() !!}
    {!! Asset::scripts() !!}

```

Above code can also be simplified as:

```

    {!! Asset::show() !!}

```

### Asset Dependencies

[](#asset-dependencies)

Sometimes you may need to specify that an asset has dependencies. This means that the asset requires other assets to be declared in your view before it can be declared. Managing asset dependencies couldn't be easier in Laravel. Remember the "names" you gave to your assets? You can pass them as the third parameter to the add method to declare dependencies:

Registering a bundle that has dependencies:

```
Asset::add('jquery-ui', 'js/jquery-ui.js', 'jquery');
```

In this example, we are registering the jquery-ui asset, as well as specifying that it is dependent on the jquery asset. Now, when you place the asset links on your views, the jQuery asset will always be declared before the jQuery UI asset. Need to declare more than one dependency? No problem:

Registering an asset that has multiple dependencies:

```
Asset::add('jquery-ui', 'js/jquery-ui.js', ['first', 'second']);
```

### Asset Containers

[](#asset-containers)

To increase response time, it is common to place JavaScript at the bottom of HTML documents. But, what if you also need to place some assets in the head of your document? No problem. The asset class provides a simple way to manage asset containers. Simply call the container method on the Asset class and mention the container name. Once you have a container instance, you are free to add any assets you wish to the container using the same syntax you are used to:

Retrieving an instance of an asset container:

```
Asset::container('footer')->add('example', 'js/example.js');
```

Dumping that assets from a given container:

```
{!! Asset::container('footer')->scripts() !!}
```

### Asset Versioning

[](#asset-versioning)

Another option to increase response time is by utilizing browser caching, while there few ways to do this we pick last modified time as our way to version the Asset.

```
Asset::container()->addVersioning();

// or alternatively
Asset::addVersioning();
```

> Note: this would only work with local asset.

You can remove adding versioning number by using:

```
Asset::container()->removeVersioning();

// or alternatively
Asset::removeVersioning();
```

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.5% 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 ~94 days

Recently: every ~121 days

Total

34

Last Release

1603d ago

Major Versions

v3.8.1 → v4.0.02019-08-29

v4.0.1 → v5.0.02020-02-28

v5.0.0 → v6.0.02020-08-29

4.x-dev → 5.x-dev2020-11-22

5.x-dev → v6.1.02021-04-17

PHP version history (9 changes)v2.0.0PHP &gt;=5.3.3

v2.2.0PHP &gt;=5.4.0

v3.1.1PHP &gt;=5.5.0

v3.3.0PHP &gt;=5.6.0

v3.5.0PHP &gt;=7.0

v3.6.0PHP &gt;=7.1

v4.0.0PHP &gt;=7.2

v6.0.0PHP &gt;=7.3

v6.1.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/172966?v=4)[Mior Muhammad Zaki](/maintainers/crynobone)[@crynobone](https://github.com/crynobone)

---

Top Contributors

[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (417 commits)")[![sergejostir](https://avatars.githubusercontent.com/u/21297285?v=4)](https://github.com/sergejostir "sergejostir (2 commits)")

---

Tags

assets-pipelinelaravelphplaravelassetorchestra-platformorchestral

### Embed Badge

![Health badge](/badges/orchestra-asset/health.svg)

```
[![Health](https://phpackages.com/badges/orchestra-asset/health.svg)](https://phpackages.com/packages/orchestra-asset)
```

###  Alternatives

[orchestra/html

HTML Component for Orchestra Platform

40112.6k2](/packages/orchestra-html)[orchestra/memory

Memory Component for Orchestra Platform

11150.0k11](/packages/orchestra-memory)[orchestra/foundation

Orchestra Platform Foundation

5675.5k5](/packages/orchestra-foundation)[orchestra/support

Support Component for Orchestra Platform

16500.4k21](/packages/orchestra-support)[orchestra/auth

Auth Component for Orchestra Platform

24108.5k3](/packages/orchestra-auth)

PHPackages © 2026

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