PHPackages                             userfrosting/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. userfrosting/assets

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

userfrosting/assets
===================

Assets module for UserFrosting

6.2.0(5y ago)447.0k↓73.3%[1 PRs](https://github.com/userfrosting/assets/pulls)MITCSSPHP ^7.1

Since Apr 5Pushed 5y ago4 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (18)Used By (0)

UserFrosting/Assets
===================

[](#userfrostingassets)

[![Latest Version](https://camo.githubusercontent.com/0336d311bb43e59031f7e78db42dee8ff1719947c0c86211c2f56b6335cde609/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7573657266726f7374696e672f6173736574732e737667)](https://github.com/userfrosting/assets)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Join the chat at https://chat.userfrosting.com/channel/support](https://camo.githubusercontent.com/3ef275424b9a67f2277aea0eeb294f16f16660d8fc4073a0a988298d626d4c5a/68747470733a2f2f636861742e7573657266726f7374696e672e636f6d2f6170692f76312f736869656c642e7376673f6e616d653d5573657246726f7374696e67)](https://chat.userfrosting.com/channel/support)[![Donate](https://camo.githubusercontent.com/9b77bd2b1b19b6b8fcbff67c4cfa703b0ab2c936b33ce26d534e1222cbdcdea6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f70656e253230436f6c6c6563746976652d446f6e6174652d626c75652e737667)](https://opencollective.com/userfrosting#backer)

BranchBuildCoverageStyle[master](https://github.com/userfrosting/assets)[![](https://github.com/userfrosting/assets/workflows/Build/badge.svg?branch=master)](https://github.com/userfrosting/assets/actions?query=workflow%3ABuild)[![](https://camo.githubusercontent.com/19b3292df14f33182d285a2b998d898dfb4392c82b0689503f7661747839c1b7/68747470733a2f2f636f6465636f762e696f2f67682f7573657266726f7374696e672f6173736574732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/userfrosting/assets)[![](https://camo.githubusercontent.com/772d9dccc7ea0aac32f9ae5f9bf7811d3939ce5be18e73792fc64863526a5758/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f35353436303233302f736869656c643f6272616e63683d646576656c6f70267374796c653d666c6174)](https://github.styleci.io/repos/55460230)[develop](https://github.com/userfrosting/assets/tree/develop)[![](https://github.com/userfrosting/assets/workflows/Build/badge.svg?branch=develop)](https://github.com/userfrosting/assets/actions?query=workflow%3ABuild) [![](https://camo.githubusercontent.com/4b415ce1489031d0ed2bc10769b5ca230ef532c6ad33817473cf81429e57ccb6/68747470733a2f2f636f6465636f762e696f2f67682f7573657266726f7374696e672f6173736574732f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/userfrosting/assets)[![](https://camo.githubusercontent.com/772d9dccc7ea0aac32f9ae5f9bf7811d3939ce5be18e73792fc64863526a5758/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f35353436303233302f736869656c643f6272616e63683d646576656c6f70267374796c653d666c6174)](https://github.styleci.io/repos/55460230)**Assets** is a library originally created for UserFrosting 4 to make it much easier to reference frontend assets in both production and development contexts.

Out of the box it can:

- Provide an easy way to generate an absolute url to an asset via a locator.
- Provide a basic level of integration with [`gulp-bundle-assets`](https://github.com/dowjones/gulp-bundle-assets) and complete integration with [`@userfrosting/gulp-bundle-assets`](https://www.npmjs.com/package/@userfrosting/gulp-bundle-assets), making it easy to reference asset bundles.
- Integrate via a common interface with virtually any bundling system.
- Integrate with Slim to serve assets that are inaccessible from the public folder, in the development context.
- Perform url-to-path transformations. Useful for making debuggable URLs that can be reverted back to the path to be used by the Slim asset server.
- Integrate with your preferred (and extendable) templating engine to provide easy access to asset bundles (that get wrapped with the appropriate tags) and individual assets.

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

[](#installation)

```
composer require userfrosting/assets
```

Usage
-----

[](#usage)

To use Assets, you will need:

- An instance of `ResourceLocator`, where you can add your desired search paths.
- The locator scheme (if it exists) you wish to look for assets in.
- The base url (used in generating URLs to assets).
- The base path (used in trimming the absolute path returned by the locator).

```
