PHPackages                             bubobox/assets - 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. bubobox/assets

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

bubobox/assets
==============

Assets is a static class that makes it very easy to add javascript or stylesheets to your views.

1.3.0(11y ago)22.6k2MITPHPPHP &gt;=5.3.2

Since Mar 19Pushed 11y ago3 watchersCompare

[ Source](https://github.com/bubobox/assets)[ Packagist](https://packagist.org/packages/bubobox/assets)[ Docs](http://github.com/bubobox)[ RSS](/packages/bubobox-assets/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (5)Used By (0)

[![alt text](https://camo.githubusercontent.com/68d461ee5cf54ffeced5565965613ebe1972a2b1d38f34658bf88e25f9806174/68747470733a2f2f636972636c6563692e636f6d2f67682f6275626f626f782f6173736574732e706e673f636972636c652d746f6b656e3d31333437306666393237393562646164303265333638316339393363316665646434626462626131 "Master build")](https://camo.githubusercontent.com/68d461ee5cf54ffeced5565965613ebe1972a2b1d38f34658bf88e25f9806174/68747470733a2f2f636972636c6563692e636f6d2f67682f6275626f626f782f6173736574732e706e673f636972636c652d746f6b656e3d31333437306666393237393562646164303265333638316339393363316665646434626462626131)

Assets
------

[](#assets)

Assets is a static class that makes it very easy to add javascript or stylesheets to your views.

Run unit tests
--------------

[](#run-unit-tests)

```
composer install --dev
cd tests
phpunit

```

Usage
-----

[](#usage)

To specify a script or stylesheet to load from your controller your can use following code:

```
use \BuboBox\Assets as Assets;
Assets::js('modules/asset/assets/script.js');
Assets::css('modules/asset/assets/style.css');

```

Now in your view you can add the script and link tags for the resources using the `Assets::render` method as follow:

```
echo Assets::render(false, true); // Output only link (stylesheet) tags
echo Assets::render(true, false); // Output only script tags
echo Assets::render(true, true); // Output both link and script tags

```

For better examples take a look in the examples folder.

Asset loading order
-------------------

[](#asset-loading-order)

You can assign a weight order to assets that you add using the second argument in the `js` and `css` method. The higher the number the earlier in the source the asset will be loaded.

```
Assets::js('modules/asset/assets/script1.js'); // Loaded third
Assets::js('modules/asset/assets/script2.js', 200); // Loaded first
Assets::js('modules/asset/assets/script3.js', 100); // Loaded second

```

If you don't specify the order weight then the default will be used and that is 0.

Modifiers
---------

[](#modifiers)

With a modifier callback function you can change the URLs of the assets before it's rendered into HTML. This can be handy if you for example want to load the .debug.js versions of your JavaScript files when your working in your development environment.

```
echo Assets::render(true, false, function($url) {
	return str_replace('.min.js', '.js', $url);
});

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~41 days

Total

4

Last Release

4314d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23435a2430f9c30343fc3a6c6cc14d5e537811e83d74887cb0891353d5fa081e?d=identicon)[Sitebase](/maintainers/Sitebase)

---

Top Contributors

[![Sitebase](https://avatars.githubusercontent.com/u/421104?v=4)](https://github.com/Sitebase "Sitebase (11 commits)")

---

Tags

cssJSloaderstylesheetassetfrontendscriptinclude

### Embed Badge

![Health badge](/badges/bubobox-assets/health.svg)

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

###  Alternatives

[almasaeed2010/adminlte

AdminLTE - admin control panel and dashboard that's based on Bootstrap 4

45.3k8.5M140](/packages/almasaeed2010-adminlte)[rmrevin/yii2-minify-view

Yii2 View component with auto minification css &amp; js in runtime

194302.3k7](/packages/rmrevin-yii2-minify-view)

PHPackages © 2026

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