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

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

tatter/assets
=============

Asset publishing and loading for CodeIgniter 4

v3.0.0(2y ago)4967.1k↑256.4%12[1 issues](https://github.com/tattersoftware/codeigniter4-assets/issues)[1 PRs](https://github.com/tattersoftware/codeigniter4-assets/pulls)5MITPHPPHP ^7.4 || ^8.0

Since Mar 14Pushed 2y ago6 watchersCompare

[ Source](https://github.com/tattersoftware/codeigniter4-assets)[ Packagist](https://packagist.org/packages/tatter/assets)[ Docs](https://github.com/tattersoftware/codeigniter4-assets)[ Fund](https://paypal.me/tatter)[ GitHub Sponsors](https://github.com/tattersoftware)[ RSS](/packages/tatter-assets/feed)WikiDiscussions develop Synced 2w ago

READMEChangelog (10)Dependencies (2)Versions (31)Used By (5)

Tatter\\Assets
==============

[](#tatterassets)

Asset handling for CodeIgniter 4

[![](https://github.com/tattersoftware/codeigniter4-assets/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-assets/actions/workflows/test.yml)[![](https://github.com/tattersoftware/codeigniter4-assets/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-assets/actions/workflows/analyze.yml)[![](https://github.com/tattersoftware/codeigniter4-assets/workflows/Deptrac/badge.svg)](https://github.com/tattersoftware/codeigniter4-assets/actions/workflows/inspect.yml)[![Coverage Status](https://camo.githubusercontent.com/63db5956d62a3fd901d5b86e945eed574647804741690b38ffb4aa18c89cd4af/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f746174746572736f6674776172652f636f646569676e69746572342d6173736574732f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/github/tattersoftware/codeigniter4-assets?branch=develop)

Quick Start
-----------

[](#quick-start)

1. Install with Composer: `> composer require tatter/assets`
2. Enable the `assets` filter in **app/Config/Filters.php**
3. Assign `$routes` to their assets in **app/Config/Assets.php**

Features
--------

[](#features)

Provides automated asset loading for CSS and JavaScript files for CodeIgniter 4.

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

[](#installation)

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

- `> composer require tatter/assets`

Or, install manually by downloading the source files and adding the directory to `app/Config/Autoload.php`.

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

[](#configuration)

The library's default behavior can be overridden or augmented by its config file. Copy **examples/Assets.php** to **app/Config/Assets.php** and follow the instructions in the comments. If no config file is found the library will use its default.

In order to use the `AssetsFilter` you must add apply it to your target routes. The filter does its own route matching so it is safe to apply it globally in **app/Config/Filters.php**. See [Controller Filters](https://codeigniter.com/user_guide/incoming/filters.html) for more info, or the **Example** section below.

Usage
-----

[](#usage)

If installed correctly CodeIgniter 4 will detect and autoload the library, config, and filter.

### Asset

[](#asset)

You may use the `Asset` class to build a tag for a single asset file:

```
