New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

gawdl3y/asset-prefixer

Automatic asset path prefixes for Laravel
50

Larablocks Analysis

gawdl3y/asset-prefixer works with Laravel 4 (latest release v1.1.1, Mar 27, 2014), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 4, past end of life
  • No release in the last 12 months (last: Mar 27, 2014)
  • 0 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Mar 27, 2014.
  • No releases in the last 12 months.
  • First released: Mar 27, 2014.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require gawdl3y/asset-prefixer
Latest Version:v1.1.1
PHP:>=5.3.0
Laravel:4
License:MIT
Last Updated:Apr 1, 2014
Links: GitHub  ·  Packagist
Maintainer: Gawdl3y

Laravel 4 Asset Prefixer

This is a simple package that allows you to provide a prefix for asset paths, for things such as using AWS S3 for assets in production, but using local copies in development.

Installation

Require this package in your composer.json and run composer update (or run composer require gawdl3y/asset-prefixer:~1.0):

"gawdl3y/asset-prefixer": "~1.0"

After installing the package, add the ServiceProvider to the providers array in app/config/app.php:

'Gawdl3y\AssetPrefixer\AssetPrefixerServiceProvider',

Also, add the facade to the aliases array:

'Asset' => 'Gawdl3y\AssetPrefixer\Asset',

Optionally, you may replace the HTML alias with it as well, since the AssetBuilder extends HtmlBuilder:

'HTML' => 'Gawdl3y\AssetPrefixer\Asset',

And finally, run composer config:publish gawdl3y/asset-prefixer

Usage

The AssetBuilder can be used as a drop-in replacement for HtmlBuilder by replacing the HTML facade alias. The methods are the same as the default ones provided by the HtmlBuilder class. The methods that AssetBuilder modifies to add the prefixes to are script(), style(), image(), linkAsset(), and linkSecureAsset(). Note that when using a prefix, linkSecureAsset() will not modify the protocol if you already provide it. I recommend using protocol-relative prefixes, like //somecdn.net/. This will use HTTP when you're viewing an HTTP page, and use HTTPS when viewing an HTTPS page.

The prefix is specified in the package's config file. Here's an example of usage and resulting output:

Prefix: //somecoolcdn.com/

View code:

{{ Asset::style('css/42.css') }}

Output:

<link media="all" type="text/css" rel="stylesheet" href="//somecoolcdn.com/css/42.css">

When using as a drop-in replacement (you replaced the HTML facade alias), you can use HTML::style('css/42.css') to get the same result.

If you need to reference an asset with a full URL, you need to specify the final parameter for the script/style/image call to be false. Example:

{{ Asset::script('//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array(), null, false) }}

Related Packages

turtlebits/keeper

Asset Manager for Laravel 4

8 1
jasonlewis/resource-watcher

Simple PHP resource watcher library.

147,877 221
adepem/laravel-assets-upload

Upload your Laravel public directory to a filesystem with an artisan command

47,662 0
hnhdigital-os/laravel-frontend-asset-loader

Provides a simplified approach to loading assets

4,089 1
tappleby/laravel-asset-manifest

Laravel 4 package for re-mapping assets paths, useful for asset revving using to...

940 4

Version History

Version Released PHP Laravel License
v1.1.1 >=5.3.0 4.* MIT
v1.1.0 >=5.3.0 4.* MIT
v1.0.1 >=5.3.0 4.* MIT
v1.0.0 >=5.3.0 4.* MIT