PHPackages                             mediactive-digital/laravel-asset-aliases - 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. mediactive-digital/laravel-asset-aliases

ActivePackage[Templating &amp; Views](/categories/templating)

mediactive-digital/laravel-asset-aliases
========================================

Link CSS / JS files in Laravel Blade templates

v0.4(7y ago)01.2k↓100%[1 issues](https://github.com/mediactive-digital/laravel-asset-aliases/issues)MITPHP

Since Jun 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mediactive-digital/laravel-asset-aliases)[ Packagist](https://packagist.org/packages/mediactive-digital/laravel-asset-aliases)[ RSS](/packages/mediactive-digital-laravel-asset-aliases/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Link CSS / JS files in Laravel Blade templates
==============================================

[](#link-css--js-files-in-laravel-blade-templates)

This package makes it easier to link CSS / JS files in Laravel Blade templates.

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

[](#installation)

#### Require the package using Composer.

[](#require-the-package-using-composer)

```
composer require mediactive-digital/laravel-asset-aliases
```

#### Laravel &lt; 5.5

[](#laravel--55)

Add the service provider to /config/app.php file.

```
'providers' => [
    // ...
	MediactiveDigital\LaravelAssetAliases\LaravelAssetAliasesServiceProvider::class,
],
```

Add the AssetManager facade to /config/app.php file.

```
'aliases' => [
    // ...
    'MDAsset' => MediactiveDigital\LaravelAssetAliases\LaravelAssetAliasesFacade::class,
],
```

Htaccess changes
----------------

[](#htaccess-changes)

In order to avoid cache issues, especially with nginx, this package add specific timestamp in the filename of js &amp; css files. `home.js` will be called as `home.{timestamp}.js`. You will need to add the following rule to your `.htaccess` file.

```

    RewriteEngine On
    RewriteRule ^(.*)\.[0-9]+\.(css|js)$ /$1.$2 [L]

```

Usage
-----

[](#usage)

You can link either an internal resource or an external URL.

#### Link CSS files.

[](#link-css-files)

simple file

```
	{!! MDAsset::addCss('stylesheet.css') !!}

```

or array of files

```
	{!! MDAsset::addCss(['stylesheet.css', 'stylesheet2.css']) !!}

```

#### Link JS files.

[](#link-js-files)

simple file

```
	{!! MDAsset::addJs('script.js') !!}

```

or array of files

```
	{!! MDAsset::addJs(['script.js', 'script2.js']) !!}

```

#### Link CSS / JS files by aliases.

[](#link-css--js-files-by-aliases)

Add aliases to the configutation file located at /config/laravel-asset-aliases/alias.php.

```
// Example
return [
	'css' => [
		'stylesheet' => 'stylesheet.css'
	],
	'js' => [
		'script' => 'script.js'
	]
];
```

Then link files by aliases, for example :

```
	{!! MDAsset::addCss('stylesheet') !!}

```

#### Support for HTML attributes.

[](#support-for-html-attributes)

You can pass any number of HTML attributes along with your file definition.
It can be done both in configuration file and / or Blade templates.
Attributes defined in Blade templates override configuration ones.

If you do so, you must use an associative array with the mandatory keys "file" and "attributes".
"file" being your file (string) and "attributes" being your HTML attribute(s) (array).

```
// Examples

// Inside configuration file :
return [
	'css' => [
		'stylesheet' => [
			'file' => 'stylesheet.css',
			'attributes' => [
				'media' => 'print',
				'title' => 'title'
			]
		],
		'other-stylesheet' => [
			'file' => 'other-stylesheet.css',
			'attributes' => [
				'media' => 'screen'
			]
		]
	],
	'js' => [
		'script' => [
			'file' => 'script.js',
			'attributes' => [
				'integrity' => 'sha384-rAnDoMkeY',
        		'crossorigin' => 'anonymous'
			]
		],
		'other-script' => [
			'file' => 'other-script.js',
			'attributes' => [
				'async' => null
			]
		]
	]
];

// Inside Blade template :
{!! MDAsset::addCss([
	[
		'file' => 'stylesheet',
		'attributes' => [
			'media' => 'print',
			'title' => 'title'
		]
	],
	[
		'file' => 'other-stylesheet',
		'attributes' => [
			'media' => 'screen'
		]
	]
]) !!}

{!! MDAsset::addJs([
	[
		'file' => 'script.js',
		'attributes' => [
			'integrity' => 'sha384-rAnDoMkeY',
			'crossorigin' => 'anonymous'
		]
	],
	'other-script' => [
		'file' => 'other-script.js',
		'attributes' => [
			'async' => null
		]
	]
]) !!}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

2584d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40459235?v=4)[Mediactive Digital](/maintainers/mediactive-digital)[@mediactive-digital](https://github.com/mediactive-digital)

---

Top Contributors

[![stfr](https://avatars.githubusercontent.com/u/93080?v=4)](https://github.com/stfr "stfr (1 commits)")

---

Tags

phpcomposerlaraveljavascriptpackagecssbladetemplate

### Embed Badge

![Health badge](/badges/mediactive-digital-laravel-asset-aliases/health.svg)

```
[![Health](https://phpackages.com/badges/mediactive-digital-laravel-asset-aliases/health.svg)](https://phpackages.com/packages/mediactive-digital-laravel-asset-aliases)
```

PHPackages © 2026

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