PHPackages                             scafera/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. [Framework](/categories/framework)
4. /
5. scafera/asset

ActiveSymfony-bundle[Framework](/categories/framework)

scafera/asset
=============

Asset management for the Scafera framework

v1.0.2(1mo ago)06MITPHPPHP &gt;=8.4

Since Apr 13Pushed 1mo agoCompare

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

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

scafera/asset
=============

[](#scaferaasset)

Asset management for the Scafera framework. Configures Symfony's AssetMapper internally — your code references assets via `asset()` in Twig templates, never through PHP imports.

> **Provides:** Asset management for Scafera — configures Symfony's AssetMapper internally; projects reference assets via Twig's `asset()` function, never PHP imports. Companion bundles (e.g. TailwindBundle) auto-register when installed.
>
> **Depends on:** A Scafera host project with `scafera/frontend` installed (for Twig's `asset()` function) and an `assets/` directory at the project root.
>
> **Extension points:** None of its own — AssetMapper is configured internally. Extra asset paths via `framework.asset_mapper.paths` in `config/config.yaml`. Ecosystem integrations (e.g. TailwindBundle) auto-register via the kernel's `extra.scafera-bundles` mechanism.
>
> **Not responsible for:** Template rendering (owned by `scafera/frontend`) · JavaScript bundling (AssetMapper uses native ES modules) · Node.js tooling (TailwindBundle manages its own standalone binary) · folder conventions (owned by architecture packages).

This is a **capability package** (adoption gate). It adds optional asset support to a Scafera project. It does not define folder structure or architectural rules — those belong to architecture packages.

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

[](#installation)

```
composer require scafera/asset
```

The bundle is auto-discovered via Scafera's `symfony-bundle` type detection. No manual registration needed.

Requirements
------------

[](#requirements)

- PHP 8.4+
- `scafera/kernel` ^1.0
- `scafera/frontend` (for template rendering with `asset()`)

Usage
-----

[](#usage)

### Referencing assets in templates

[](#referencing-assets-in-templates)

Place CSS, JS, and other static files in `assets/` at your project root. Reference them in Twig templates using the `asset()` function:

```

```

### Using with Tailwind CSS

[](#using-with-tailwind-css)

Install the TailwindBundle — it is auto-registered as a companion bundle:

```
composer require symfonycasts/tailwind-bundle
```

Initialize and build:

```
vendor/bin/scafera symfony tailwind:init
vendor/bin/scafera symfony tailwind:build
```

For development with auto-rebuild on file changes:

```
vendor/bin/scafera symfony tailwind:build --watch
```

Reference the compiled CSS in your template:

```

```

### Production deployment

[](#production-deployment)

Compile assets with versioned filenames for cache busting:

```
vendor/bin/scafera symfony asset-map:compile
```

This writes versioned files to `public/assets/` for direct serving by the web server.

Companion Bundles
-----------------

[](#companion-bundles)

This package declares companion bundles via `extra.scafera-bundles` in its `composer.json`. When you install a companion package, Scafera registers its bundle automatically — no manual configuration needed.

PackageBundlePurpose`symfonycasts/tailwind-bundle``SymfonycastsTailwindBundle`Tailwind CSS compilation via standalone binaryCompanions are only registered when installed. If you don't `composer require` the package, the declaration is ignored.

Boundary Enforcement
--------------------

[](#boundary-enforcement)

This package includes an `AssetMapperLeakageValidator` that scans your `src/` directory for direct `Symfony\Component\AssetMapper\*` imports. Violations are reported by `scafera validate`:

```
Package checks:
  ✗ No AssetMapper imports in userland FAILED
    - src/Service/AssetHelper.php: imports AssetMapper types directly — use asset() in Twig templates instead

```

Use `asset()` in templates — don't import AssetMapper types in PHP.

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

[](#configuration)

The bundle configures AssetMapper automatically:

- **Asset paths**: `assets/` at your project root
- **Public prefix**: `/assets/`

To override defaults, add a `framework:` section to `config/config.yaml`:

```
framework:
    asset_mapper:
        paths:
            - 'assets/'
            - 'vendor/some-package/assets/'
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance89

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Total

3

Last Release

54d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e9233f415f42755f68dc3006e2853b76c34de54b04c9535202b70aa147790e6a?d=identicon)[samaphp](/maintainers/samaphp)

---

Top Contributors

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

---

Tags

phpassetasset-mapperscafera

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[sulu/sulu

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

1.3k1.4M195](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[symfony/symfony-demo

Symfony Demo Application

2.6k249.0k](/packages/symfony-symfony-demo)[shopware/storefront

Storefront for Shopware

684.4M207](/packages/shopware-storefront)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)

PHPackages © 2026

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