PHPackages                             dmlogic/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dmlogic/assets

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

dmlogic/assets
==============

Static asset manager

0.1(13y ago)1305MITPHPPHP &gt;=5.3.0

Since Mar 21Pushed 13y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Assets
======

[](#assets)

ANOTHER static Asset manager package for PHP 5.3+

This one is designed to support the following workflow:

- Assets are defined as Containers of one or more stylesheets or scripts
- Container contents can vary between environments
- Your app controllers or endpoints can render Containers ready for views via a very simple interface
- The package does NOT currently compile or combine assets - you would do that using your build/deploy process and reflect the differing Container contents in your environments
- Very extensible. More StaticAssets could be added such as SASS, LESS or Coffeescript. Or maybe even an Image class that outputs the [Picture element](http://picture.responsiveimages.org/#example-of-usage). See comments in the Classes for more info

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

[](#installation)

Install via Composer (dmlogic/assets) or

```
include 'Assets/Assets.php';
include 'Assets/StaticAsset.php';
include 'Assets/Script.php';
include 'Assets/Style.php';

use Dmlogic\Assets\Assets as Assets;

```

### Installing to Laravel 4

[](#installing-to-laravel-4)

Add the following to the 'require' section of your composer.json file.

```
"dmlogic/assets": "*"

```

Now run `composer update`.

You can then use the package immediately via the namespace e.g.

```
$myContainer = Dmlogic\Assets\Assets::container();

```

However, for easier usage, complete the following steps.

#### Add an Alias

[](#add-an-alias)

Open the file app/config/app.php and add a line to the 'aliases' array:

```
'Assets' => 'Dmlogic\Assets\Assets'

```

You can now access the main class using

```
$myContainer = Assets::container();

```

#### Utilise cascading config files

[](#utilise-cascading-config-files)

Create an assets.php file in your app/config folder and add an array as described in the 'Generate Containers from text arrays' section below.

Then duplicate and adjust this file for your different environment folders.

Usage
-----

[](#usage)

The interface is a simplified form of the Laravel 3 Asset class. Create one or more containers, add assets to them and then render within a view.

### Create new containers

[](#create-new-containers)

This one will be called 'default'

```
$myContainer = Assets::container();

```

This one will be called 'home'

```
$homeContainer = Assets::container('home');

```

### Add an asset

[](#add-an-asset)

```
$myAsset = new Dmlogic\Assets\Style(array(
                                        'path'  => '/assets/css/bootstrap.css',
                                        'media' => 'screen'
                                     ))
$myContainer->add($myAsset);

```

### Render the Container

[](#render-the-container)

```

```

and

```

```

### Create named container and add multiple assets in one command

[](#create-named-container-and-add-multiple-assets-in-one-command)

```
$myAssets = array(

    new Dmlogic\Assets\Style(array(
                                'path'  => '/assets/css/bootstrap.css',
                                'media' => 'screen'
                             )),

    new Dmlogic\Assets\Style(array(
                                'path'  => '/assets/css/print.css',
                                'media' => 'print'
                             )),

    new Dmlogic\Assets\Script(array(
                                'path' => '/assets/js/bootstrap.js',
                              ))

    new Dmlogic\Assets\Script(array(
                                'inline' => 'console.log("useful, huh?")'
                              ))
);

Assets::container('home')->add($myAssets);

```

### Render assets from named Container

[](#render-assets-from-named-container)

```
echo Assets::container('home')->styles();

echo Assets::container('home')->scripts();

```

### Generate Containers from text arrays

[](#generate-containers-from-text-arrays)

One of the most likely uses of this package is to define your containers in config files that vary per environment. A method `createContainer()` is available to make this a simple process. It accepts two parameters, a config array in the format [described here](https://github.com/dmlogic/assets/blob/master/samples/config.php)and the name of the container.

```
$containers = include '/config/packages/[your_environment]/assets.php';

$defaultAssets = Assets::createContainer( $containers['default'] );

$homeAssets = Assets::createContainer( $containers['home'], 'home' );

```

Roadmap
-------

[](#roadmap)

- Decent Exception handling
- Picture Element Asset type perhaps?
- Sizable image Asset type perhaps?
- SVG with PNG fallback for old IE perhaps?

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

4842d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1250252?v=4)[Darren Miller](/maintainers/dmlogic)[@dmlogic](https://github.com/dmlogic)

---

Tags

cssJSstaticasset

### Embed Badge

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

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

###  Alternatives

[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k32.3M422](/packages/matthiasmullie-minify)[stolz/assets

An ultra-simple-to-use assets management library

289527.4k8](/packages/stolz-assets)[onokumus/metismenu

A jQuery menu plugin

2.0k268.5k5](/packages/onokumus-metismenu)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

57133.6k1](/packages/sensiolabs-minify-bundle)[jalle19/php-yui-compressor

A modern PHP wrapper for the YUI compressor

16977.5k3](/packages/jalle19-php-yui-compressor)[fisharebest/laravel-assets

Asset management for Laravel

208.1k](/packages/fisharebest-laravel-assets)

PHPackages © 2026

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