PHPackages                             dawn/wordpress\_asset - 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. dawn/wordpress\_asset

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

dawn/wordpress\_asset
=====================

wordpress register or enqueue assets

1.0.2(7y ago)010MITPHPPHP &gt;=7.0

Since Nov 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/fafucoder/wordpress_asset)[ Packagist](https://packagist.org/packages/dawn/wordpress_asset)[ RSS](/packages/dawn-wordpress-asset/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Wordpress Asset
---------------

[](#wordpress-asset)

This is wordpress asset register or enqueue library

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

[](#installation)

Fetch this package via composer

```
$ composer require dawn/wordpress_asset

```

Usage
-----

[](#usage)

If you only want to register a single resource, you can use `Script` class or `Style` class. The methods and property in `Script` class and `Style` class are basically the same, except `Script` class have async and defer property.

```
Script::add('foo', array(
	'ver' => '1.0.0',
	'deps' => array('jquery'),
	'path' => '/fixtures/foo.js',
	'base' => '/public',
	'footer' => 'true',
	'area' => 'front',
	'async' => true,
  ));
```

If you have many asset to register, you can use `Package` Class, `add` function is register asset and `enqueue` function is enqueue asset

```
Package::add('foo', array(
	'script' => array(
		'bar' => array(
			'path' => '/fixtures/bar.js',
			'ver' => '1.2.0',
		),
		'foo' => array(
			'path' => '/fixtures/foo.js',
			'area' => 'admin',
		),
	),
	'style' => array(
		'bar' => array(
			'path' => '/fixtures/bar.css',
		),
		'foo' => array(
			'path' => '/fixtures/foo.css',
		),
	),
	'version' => '1.0.0',
	'base' => '/public',
));
```

If you have many asset to pre register but register only when necessary. use `Package` may result memory waste, use `PackageManger` is good idea.

```
$packageManager->register(array(
	'jquery' => array(
		'scripts' => array('jquery.js'),
		'styles' => array('jquery.css'),
	),
	'react' => array(
		'scripts' => array('react.js'),
		'styles' => array('react.css'),
	),
	'bootstrap' => array(
		'scripts' => array('bootstrap.js'),
		'styles' => array('bootstrap.css'),
	),
), array(
	'base' => '/public/asset/',
	'area' => 'public',
	'version' => '1.5.0',
));

//use PackgeManager->add will register asset
$packageManger->add('react');

//use pakcageManger->queue will enqueue asset
$packgeManger->queue('react');
```

Asset Location
--------------

[](#asset-location)

you can register asset to front or admin and others, Below is the area where you can register.

areahookfrontwp\_enqueue\_scriptsadminadmin\_enqueue\_scriptsloginlogin\_enqueue\_scriptsblock\_editorenqueue\_block\_editor\_assetblockenqueue\_block\_assetsAll functions
-------------

[](#all-functions)

functiondescriptionreturnScript::add/Style::add/Package::addregister script/stylereturn instance objectScript::queue/Style::queue/Package::queueenqueue script/stylereturn instance objectScript::remove/Style::remove/Package::removeremove enqueued or registered script/stylereturn voidScript::load/Style::loadload wordpress system assetreturn instance objectScript::get/Style::get/Package::getget registered script/stylereturn instance objectScript::has/Style::has/Package::hashas script/style instancereturn boolean$style/$script-&gt;inline()inline style/scriptreturn $this$style/$script-&gt;dependences()the register asset dependencesretrun $this$script-&gt;in()the inline script positionreturn $this$style/$script-&gt;area()the asset register locationreturn $this$style/$script-&gt;base()the asset base pathreturn $this$style/$script-&gt;path()the asset pathreturn $this$style-&gt;media()the style mediareturn $this$style-&gt;attribute()attribute stylereturn $this$script-&gt;footer()if register script in footerreturn $this$script-&gt;localize()localize scriptreturn $this$script-&gt;defer()defer scriptreturn $this$script-&gt;async()async scriptreturn $thismore information you looking for source code

License
-------

[](#license)

MIT License

Copyright (c) 2018 dawn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

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

Total

3

Last Release

2742d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e63e3c1806ec2b689816f622f1782eb8677d5aac8707b76b3e3cfef3232d2c25?d=identicon)[dawn](/maintainers/dawn)

---

Top Contributors

[![fafucoder](https://avatars.githubusercontent.com/u/16442491?v=4)](https://github.com/fafucoder "fafucoder (16 commits)")

---

Tags

wordpressassetswordpress-asset

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dawn-wordpress-asset/health.svg)

```
[![Health](https://phpackages.com/badges/dawn-wordpress-asset/health.svg)](https://phpackages.com/packages/dawn-wordpress-asset)
```

###  Alternatives

[tgmpa/tgm-plugin-activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins).

1.8k222.5k13](/packages/tgmpa-tgm-plugin-activation)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[maba/webpack-bundle

Bundle to Integrate Webpack to Symfony

123268.2k4](/packages/maba-webpack-bundle)

PHPackages © 2026

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