PHPackages                             underpin/style-loader - 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. underpin/style-loader

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

underpin/style-loader
=====================

1.2.0(4y ago)0254[1 issues](https://github.com/Underpin-WP/style-loader/issues)2GPL-2.0-or-laterPHP

Since May 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Underpin-WP/style-loader)[ Packagist](https://packagist.org/packages/underpin/style-loader)[ RSS](/packages/underpin-style-loader/feed)WikiDiscussions master Synced 6d ago

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

Underpin Style Loader
=====================

[](#underpin-style-loader)

Loader That assists with adding styles to a WordPress website.

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

[](#installation)

### Using Composer

[](#using-composer)

`composer require underpin/loaders/styles`

### Manually

[](#manually)

This plugin uses a built-in autoloader, so as long as it is required *before*Underpin, it should work as-expected.

`require_once(__DIR__ . '/underpin-styles/styles.php');`

Setup
-----

[](#setup)

1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)
2. Register new styles as-needed.

Example
-------

[](#example)

A very basic example could look something like this.

```
underpin()->styles()->add( 'test', [
	'src'         => 'path/to/style/src',
	'name'        => 'test',
	'description' => 'The description',
] );
```

Alternatively, you can extend `Style` and reference the extended class directly, like so:

```
underpin()->styles()->add('key','Namespace\To\Class');
```

Enqueuing Styles
----------------

[](#enqueuing-styles)

To enqueue a styles, run the loader and reference the style ID, like so:

```
underpin()->style()->enqueue('test'); // Enqueue the test style
```

### Enqueuing With Middleware

[](#enqueuing-with-middleware)

In circumstances where you *always* need to enqueue the style, you can use the provided enqueue middleware.

To enqueue on admin screens:

```
underpin()->styles()->add( 'test', [
        'handle'      => 'test',
        'src'         => 'path/to/style/src',
        'name'        => 'test',
        'description' => 'The description',
        'middlewares' => [
          'Underpin_Styles\Factories\Enqueue_Admin_Style'
        ]
] );
```

To enqueue on the front-end:

```
underpin()->styles()->add( 'test', [
        'handle'      => 'test',
        'src'         => 'path/to/style/src',
        'name'        => 'test',
        'description' => 'The description',
        'middlewares' => [
          'Underpin_Styles\Factories\Enqueue_Style'
        ]
] );
```

To enqueue on both front-end and back-end:

```
underpin()->styles()->add( 'test', [
        'handle'      => 'test',
        'src'         => 'path/to/style/src',
        'name'        => 'test',
        'description' => 'The description',
        'middlewares' => [
          'Underpin_Styles\Factories\Enqueue_Style',
          'Underpin_Styles\Factories\Enqueue_Admin_Style'
        ]
] );
```

### Create Your Own Middleware

[](#create-your-own-middleware)

The `middlewares` array uses `Underpin::make_class` to create the class instances. This means that you can pass either:

1. a string that references an instance of `Style_Middleware` (see example above).
2. An array of arguments to construct an instance of `Style_Middleware` on-the-fly.

```
underpin()->styles()->add( 'test', [
	'handle'      => 'test',
	'src'         => 'path/to/style/src',
	'name'        => 'test',
	'description' => 'The description',
	'middlewares' => [
		'Underpin_Styles\Factories\Enqueue_Style',            // Will enqueue the style on the front end all the time.
		[                                                     // Will instantiate an instance of Style_Middleware_Instance using the provided arguments
			'name'                => 'Custom setup params',
			'description'         => 'Sets up custom parameters specific to this style',
			'priority'            => 10, // Optional. Default 10.
			'do_actions_callback' => function ( \Underpin_Styles\Abstracts\Style $loader_item ) {
				// Do actions
			},
		],
	],
] );
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

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

Total

5

Last Release

1637d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e6206223bd6f2a57b8ac80605b1b5c3521faaec18ad3f20f25fb728a9a13784?d=identicon)[tstandiford](/maintainers/tstandiford)

---

Top Contributors

[![alexstandiford](https://avatars.githubusercontent.com/u/8210827?v=4)](https://github.com/alexstandiford "alexstandiford (21 commits)")

---

Tags

stylesunderpinwordpress

### Embed Badge

![Health badge](/badges/underpin-style-loader/health.svg)

```
[![Health](https://phpackages.com/badges/underpin-style-loader/health.svg)](https://phpackages.com/packages/underpin-style-loader)
```

###  Alternatives

[astrotomic/php-open-graph

Easily generate Open Graph tags

6244.7k3](/packages/astrotomic-php-open-graph)

PHPackages © 2026

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