PHPackages                             flexycms/asset-manager - 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. flexycms/asset-manager

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

flexycms/asset-manager
======================

Small assets manager

0.2.1(2y ago)125BSD-3-ClausePHPPHP &gt;7.4

Since Nov 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Khorsa/asset-manager)[ Packagist](https://packagist.org/packages/flexycms/asset-manager)[ Docs](https://github.com/Khorsa/asset-manager)[ RSS](/packages/flexycms-asset-manager/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

khorsa/asset-manager
====================

[](#khorsaasset-manager)

Utility classes to organize assets in website.

Installation
------------

[](#installation)

You can add this library as local by downloading zip archive, or through composer:

```
composer require flexycms/asset-manager

```

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:

```
composer require --dev flexycms/asset-manager

```

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

```
$DR = $_SERVER['DOCUMENT_ROOT'];
$assets = new Flexycms\AssetManager\AssetManager();

$assets->scripts()->setCompiledFile($DR . "/assets/js/.compiled.js");
$assets->scripts()->addFile([
	$DR . "/assets/js/module1.js",
	$DR . "/assets/js/module2.js",
	$DR . "/assets/js/module3.js",
]);

$assets->styles()->addFile([
	$DR . "/assets/css/styles1.scss",
	$DR . "/assets/css/styles2.css",
	$DR . "/assets/css/styles3.css",
]);

$scriptsArray = $assets->scripts()->getRefs();
$stylesArray = $assets->styles()->getRefs();
```

### AssetManager usage

[](#assetmanager-usage)

```
$assets = new Flexycms\AssetManager\AssetManager();

$scriptManager = $assets->scripts(); // get script manager
$styleManager = $assets->styles(); // get styles manager
```

### ScriptManager usage

[](#scriptmanager-usage)

```
$assets = new Flexycms\AssetManager\AssetManager();
$DR = $_SERVER['DOCUMENT_ROOT'];    // /var/www for example

/**
Set compiled file
*/
$assets->scripts()->setCompiledFile($DR . "/assets/js/.compiled.js");

/**
Add one JS file
*/
$assets->scripts()->addFile($DR . "/assets/js/main_script.js");

/**
Add JS files as array
*/
$assets->scripts()->addFile([
    $DR . "/assets/js/script_1.js",
    $DR . "/assets/js/script_2.js",
    $DR . "/assets/js/script_3.js",
]);

/**
Add file and disallow combine it with compiled file
(It work with array too)
*/
$assets->scripts()->addFile($DR . "/assets/js/as_is_file.js", false);

/**
Add all JS files in directory, except "ignored.js"
Files in directory: "a.js", "b.js", "c.js", "ignored.js"
*/
$assets->scripts()->addIgnoreFile($DR . "/assets/js/modules/ignored.js");
$assets->scripts()->addDir($DR . "/assets/js/modules/");

/**
Add external JS
*/
$assets->scripts()->addFile("https://example.com/libs/external_js_file.js");

/**
Get result files
*/
$result = $assets->scripts()->get();
/**
$result = [
    "/var/www/assets/js/.compiled.js",
    "/var/www/assets/js/as_is_file.js",
    "https://example.com/libs/external_js_file.js",
]

".compiled.js" will contains compressed content of previously added files:
/var/www/assets/js/main_script.js
/var/www/assets/js/script_1.js,
/var/www/assets/js/script_2.js,
/var/www/assets/js/script_3.js,
/var/www/assets/js/modules/a.js,
/var/www/assets/js/modules/b.js,
/var/www/assets/js/modules/c.js,
*/

/**
Get refs for files
*/
$assets->scripts()->getRefs();
/**
$result = [
    "/assets/js/.compiled.js",
    "/assets/js/as_is_file.js",
    "https://example.com/libs/external_js_file.js",
]
*/
```

### StyleManager usage

[](#stylemanager-usage)

```
$assets = new Flexycms\AssetManager\AssetManager();
$DR = $_SERVER['DOCUMENT_ROOT'];    // /var/www for example

/**
Add CSS or SCSS file
*/
$assets->styles()->addFile($DR . "/assets/css/fonts/roboto.css");

/**
Add CSS and SCSS files as array
*/
$assets->styles()->addFile([
	$DR . "/assets/css/styles.scss",
	$DR . "/assets/css/images.css",
]);

/**
Add external style
*/
$assets->styles()->addFile("https://example.com/libs/external_css_file.css");

/**
Disable inline sourcemap generation (for prod environment for example)
*/
$assets->styles()->disableSourcemap();

/**
Enable inline sourcemap generation
*/
$assets->styles()->enableSourcemap();

/**
Get result files
*/
$result = $assets->scripts()->get();
/**
$result = [
    "/var/www/assets/css/fonts/roboto.css",
    "/var/www/assets/css/styles.min.css",
    "/var/www/assets/css/images.css",
    "https://example.com/libs/external_css_file.css",
]

styles.min.css is a result of processing styles.scss and will contain sourcemap block at the end of file (look ::enableSourcemap())

*/

/**
Get refs for files
*/
$assets->scripts()->getRefs();
/**
$result = [
    "/assets/css/fonts/roboto.css",
    "/assets/css/styles.min.css",
    "/assets/css/images.css",
    "https://example.com/libs/external_css_file.css",
]
*/
```

For work with CSS modules use SCSS @import directive inside one of your SCSS files

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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 ~382 days

Total

3

Last Release

937d ago

PHP version history (2 changes)0.1.0PHP ^7.4

0.2.1PHP &gt;7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/58188ce140ee974c212fe34fd7bc96ae242ad932e80abc7e4493bf07d577986d?d=identicon)[khorsa](/maintainers/khorsa)

---

Top Contributors

[![Khorsa](https://avatars.githubusercontent.com/u/5018897?v=4)](https://github.com/Khorsa "Khorsa (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[october/rain

October Rain Library

1601.7M83](/packages/october-rain)[shopware/storefront

Storefront for Shopware

684.6M236](/packages/shopware-storefront)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[mapbender/mapbender

Mapbender library

10418.3k8](/packages/mapbender-mapbender)[wapplersystems/ws-scss

Compiles SCSS to CSS at runtime with caching, TypoScript variables and EXT: import support

11149.9k8](/packages/wapplersystems-ws-scss)

PHPackages © 2026

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