PHPackages                             konstantin-s/silex-assetmerge - 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. konstantin-s/silex-assetmerge

AbandonedArchivedLibrary

konstantin-s/silex-assetmerge
=============================

Merging list of JS or CSS files to one. Merged files is cached to disk. Twig required.

v0.151(10y ago)127[1 issues](https://github.com/konstantin-s/silex-assetmerge/issues)MITPHP

Since Jan 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/konstantin-s/silex-assetmerge)[ Packagist](https://packagist.org/packages/konstantin-s/silex-assetmerge)[ RSS](/packages/konstantin-s-silex-assetmerge/feed)WikiDiscussions master Synced 2mo ago

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

silex-assetmerge
================

[](#silex-assetmerge)

Description
-----------

[](#description)

For boosting performance is recommended to reduce number of requests to web server.

I noticed that too many CSS and JS files are loaded at my site and decided to radically reduce their numbers by merging to one file.

Automatically, configurable, reusable.

> It is my first shared project on Github and english language not my mother tongue. I am Sorry!

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

[](#installation)

#### Via composer:

[](#via-composer)

```
composer require konstantin-s/silex-assetmerge
```

[See at Packagist ](https://packagist.org/packages/konstantin-s/silex-assetmerge)

Usage
-----

[](#usage)

### Register Provider

[](#register-provider)

```
$app->register(new Performance\AssetMerge\AssetMergeProvider());
```

### Config parameters

[](#config-parameters)

namedefaultdescriptionactivetrueIf set to false getScripts() returns HTML code with unmerged filesalwaysReMergefalseIf set to true on every call getScripts() recreate merged files (useful when you modify scripts and styles)fetchRemotetrueIf set to true remote files will be downloaded and mergedflushMergedfalseIf set to true method "flushMerged" (Delete all dirs, containing merged JS and CSS files, in configured CssRootDir and JsRootDir) will be called before any action.mergedCssRootDir"/assets/merged/"Dir where to store merged CSS files. At this dir will be created subdir with name "hash\_of\_names\_files\_to\_merge" with merged file. Relative to front controller dir.mergedJsRootDir"/assets/merged/"Dir where to store merged JS files. At this dir will be created subdir with name "hash\_of\_names\_files\_to\_merge" with merged file. Relative to front controller dir.webRootresult of: $app\["request"\]-&gt;server-&gt;get("CONTEXT\_DOCUMENT\_ROOT")Used for build absolute filepaths### Register Provider with parameters

[](#register-provider-with-parameters)

```
$app->register(new Performance\AssetMerge\AssetMergeProvider(), array(
    "assetmerge.config" => array(
        "active" => true,
        "alwaysReMerge" => true,
        "fetchRemote" => false,
        "mergedCssRootDir" => "/my_merged_css/",
        "mergedJsRootDir" => "/my_merged_js/"
    )
));
```

### Usage in TWIG templade

[](#usage-in-twig-templade)

```
{% set cssFiles = ["/assets/vendor/twbs/css/bootstrap.css",
"/assets/vendor/twbs/css/bootstrap-theme.css",
"/assets/vendor/prism/prism.css",
"/assets/styles/style.css"] %}
{{ app.assetmerge_config.setCssFiles(cssFiles) }}

{% set jsFiles = ["https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js",
"/assets/vendor/twbs/js/bootstrap.js",
"/assets/vendor/prism/prism.js",
"/assets/scripts/common.js"] %}
{{ app.assetmerge_config.setJsFiles(jsFiles) }}

{# You can set parameters, set to inactive for example:
{{ app.assetmerge_config.setactive(false) }}
#}
{{app.assetmerge_merger.getScripts|raw}}
```

### Example output of {{app.assetmerge\_merger.getScripts|raw}}

[](#example-output-of-appassetmerge_mergergetscriptsraw)

```

```

> where `6e8109cbc09fbc2b4b1543b8d1f33c14` and `df764eb96f1c811270e575caaa87de82` is md5 hashes of files names, passed to setCssFiles() and setJsFiles()

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

4

Last Release

3742d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7065dd7aa02b475087900a38aa4f85f5f8bead8a69bf2d0fd5efcd4b9906fbf0?d=identicon)[konstantin-s](/maintainers/konstantin-s)

---

Top Contributors

[![konstantin-s](https://avatars.githubusercontent.com/u/9697235?v=4)](https://github.com/konstantin-s "konstantin-s (13 commits)")

### Embed Badge

![Health badge](/badges/konstantin-s-silex-assetmerge/health.svg)

```
[![Health](https://phpackages.com/badges/konstantin-s-silex-assetmerge/health.svg)](https://phpackages.com/packages/konstantin-s-silex-assetmerge)
```

###  Alternatives

[symfony/debug-bundle

Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework

2.4k115.8M824](/packages/symfony-debug-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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