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

ActiveLibrary

lightgear/asset
===============

Easy asset Management for Laravel 4

2.0.0(12y ago)242.0k16PHPPHP &gt;=5.3.0

Since Oct 29Pushed 12y ago2 watchersCompare

[ Source](https://github.com/lightgear/asset)[ Packagist](https://packagist.org/packages/lightgear/asset)[ RSS](/packages/lightgear-asset/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (7)Used By (6)

Discountinued
=============

[](#discountinued)

This project has been discountinued since there are better way to handle assets nowadays.
I switched to [Gulp.js](http://gulpjs.com/) and will not get back.
This repository will be kept in case somebody uses it in production.

Simple and effective assets management for Laravel 4
====================================================

[](#simple-and-effective-assets-management-for-laravel-4)

Overview
--------

[](#overview)

The Lightgear/Asset package is meant to simplify the creation and maintenance of the essential assets of a Laravel 4 based application.

Features
--------

[](#features)

- **Supported asset types**: "**less**", "**css**"" and "**javascript**" files. I do NOT plan to add support for other types like Coffeescript simply because I want to keep the package footprint as small as possible.
- **Combining and minifying** (any combination of the two) are fully supported
- Simple but effective **caching** support is provided. This avoids generation of the assets on every request. Caching needs to be turned on in the config (since you probably only want to do this on production).
- **Asset groups**

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

[](#installation)

### Via Laravel 4 Package Installer

[](#via-laravel-4-package-installer)

```
php artisan package:install lightgear/asset
```

### Manual

[](#manual)

Just require

```
"lightgear/asset": "1.1"
```

in your composer.json and run

```
composer update
```

Then register the service provider

```
'Lightgear\Asset\AssetServiceProvider'
```

and, optionally, the alias

```
'Asset' => 'Lightgear\Asset\Facades\Asset'
```

in **app/config/app.php**

Publish configuration with

```
php artisan config:publish lightgear/asset
```

This will ceate the **app/config/packages/lightgear/asset/config.php** file.

Finally create the directory specified as "public\_dir" in the config file and give it full writing permissions.

Usage
-----

[](#usage)

All you need to do is register your assets with either **registerStyles()** or **registerScripts()** methods. Important: assets need to be registered **in a file which is always loaded** (ex. in a package's ServiceProvider). For example, to register a package assets you would use something like this in your service provider:

```
/**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $styles = array(
            'src/assets/styles',
            'src/assets/pure/pure/pure-min.css'
        );

        $asset = $this->app->make('asset');

        // register styles of a vendor package and assign them
        // to the default "general" group
        $asset->registerStyles($styles, 'vendor/package');

        // register styles of a vendor package and assign them
        // to the "frontend" group
        $asset->registerStyles($styles, 'vendor/package', 'frontend');

        // the same goes with scripts for whom you would use for example
        $asset->registerScripts(array('src/scripts')), 'vendor/package');
    }
```

or you could register assets located in **app/assets** with

```
Asset::registerStyles(array(
        'css/shared.less'
    )
);
or
Asset::registerScripts(array(
        'js/shared.js'
    )
);
```

As you notice in the examples both files and directories can be registered. It's worth noticing that **directories are added recursively**.

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

[](#configuration)

A number of config options allow you to customize the handling of the assets. Please check **src/config/config.php** for details.

Templating
----------

[](#templating)

The assets can be printed out in a (blade) template by using

```
// prints all the registered styles
{{ Asset::styles() }}

// prints only the "frontend" group
{{ Asset::styles('frontend') }}

// prints the "frontend" and "mygroup" groups
{{ Asset::styles(array('frontend', 'mygroup')) }}
```

and the same syntax is used for the scripts

```
{{ Asset::scripts() }}
```

Artisan commands
----------------

[](#artisan-commands)

The package comes with 2 commands:

```
php artisan asset:clean
```

which deletes all published and cached assets and

```
php artisan asset:generate
```

which generates and publishes the registered assets

Permissions
-----------

[](#permissions)

If you experience permissions issues when running the above commands, it's because the user running artisan is different from the one that generates the assets through the webserver (www-data for example). The issue is explained in greater details at To fix the issue it's enough to follow the steps outlined in this page. For example on Ubuntu I run the following commands from the project root

```
sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX public/assets
sudo setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX public/assets
```

When using caching, you would need to do the same

```
sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/storage
sudo setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX app/storage
```

Changelog
---------

[](#changelog)

1.1: Laravel 4.1 compatibility
1.0: add support for asset groups and improve cache handling
0.8: initial release

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~13 days

Total

5

Last Release

4528d ago

Major Versions

0.8 → 1.02013-11-05

1.2 → 2.0.02013-12-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/0dd711f6813d8f62e12e22c2646641f7960e95969e2c823b07d5f4bd063d2cc7?d=identicon)[ralf57](/maintainers/ralf57)

---

Top Contributors

[![ralf57](https://avatars.githubusercontent.com/u/208237?v=4)](https://github.com/ralf57 "ralf57 (50 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")

### Embed Badge

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

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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