PHPackages                             psychob/theme-bundle - 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. psychob/theme-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

psychob/theme-bundle
====================

Symfony bundle for combining and serving CSS/JS theme files with HTTP caching and source maps

050↓50%PHPCI passing

Since Feb 9Pushed 3mo agoCompare

[ Source](https://github.com/psychob/symfony-theme-bundle)[ Packagist](https://packagist.org/packages/psychob/theme-bundle)[ RSS](/packages/psychob-theme-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Theme Bundle
============

[](#theme-bundle)

A Symfony bundle that combines and serves CSS/JS files as single bundled assets with intelligent HTTP caching and source map support.

Features
--------

[](#features)

- **File combining** — merge multiple CSS or JS files into a single response
- **Namespace paths** — organize assets with `@namespace/file.css` references
- **HTTP caching** — automatic ETag, Last-Modified, and 304 Not Modified responses
- **Source maps** — v3 source map generation for combined files (configurable)
- **Twig integration** — `themeAsset()` function for easy template usage
- **Performance profiling** — optional Stopwatch integration

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

[](#requirements)

- PHP 8.4+
- Symfony 8.0+
- Twig 3.0+ or 4.0+

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

[](#installation)

```
composer require psychob/theme-bundle
```

The bundle auto-registers via Symfony Flex.

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

[](#configuration)

Create or edit `config/packages/theme.yaml`:

```
theme:
    # Enable source map generation (useful in dev)
    sourcemaps: '%kernel.debug%'

    # Map namespace aliases to filesystem directories
    paths:
        '%kernel.project_dir%/assets/css': app
        '%kernel.project_dir%/vendor/some-lib/styles': lib

    # Define combined file bundles
    files:
        app.css:
            - '@app/reset.css'
            - '@app/layout.css'
            - '@lib/components.css'
            - '@app/main.css'
        app.js:
            - '@app/utils.js'
            - '@app/main.js'
```

### Options

[](#options)

OptionTypeDefaultDescription`sourcemaps``bool``false`Enable source map generation`paths``map``{}`Maps filesystem directories to namespace aliases`files``map``{}`Defines combined output files and their source filesUsage
-----

[](#usage)

### Twig

[](#twig)

Use `themeAsset()` to generate URLs to combined files:

```

```

This generates URLs like `/_/theme/app.css` and `/_/theme/app.js`.

### HTTP Caching

[](#http-caching)

The bundle serves combined files at `/_/theme/{file}` with:

- **ETag** header for cache validation
- **Last-Modified** header as fallback
- **304 Not Modified** responses when content hasn't changed
- **Cache-Control: public, must-revalidate**

Source maps are served at `/_/theme/{hash}.{ext}.map` with immutable, long-lived cache headers (1 year).

### Namespaces

[](#namespaces)

The `@namespace/` prefix in file paths resolves to the directory mapped in `paths`:

```
theme:
    paths:
        '%kernel.project_dir%/assets/css': app

    files:
        app.css:
            - '@app/reset.css'   # resolves to %kernel.project_dir%/assets/css/reset.css
```

Development
-----------

[](#development)

```
# Run tests
composer test

# Run tests with coverage
composer test:coverage

# Static analysis
composer psalm

# Check code style
composer lint

# Fix code style
composer format
```

License
-------

[](#license)

[MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance54

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/196d7a06a111694db272e50fd2fb583cfdb71c5b46f6b7bb2b09e45f61ccc438?d=identicon)[psychob](/maintainers/psychob)

---

Top Contributors

[![psychob](https://avatars.githubusercontent.com/u/1288577?v=4)](https://github.com/psychob "psychob (13 commits)")

### Embed Badge

![Health badge](/badges/psychob-theme-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/psychob-theme-bundle/health.svg)](https://phpackages.com/packages/psychob-theme-bundle)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

555.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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