PHPackages                             brightnucleus/dependencies - 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. brightnucleus/dependencies

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

brightnucleus/dependencies
==========================

Config-driven WordPress dependencies.

v0.3.5(6y ago)89.8k↓50%4MITPHPCI passing

Since Feb 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/brightnucleus/dependencies)[ Packagist](https://packagist.org/packages/brightnucleus/dependencies)[ RSS](/packages/brightnucleus-dependencies/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (19)Used By (4)

Bright Nucleus Dependencies Component
=====================================

[](#bright-nucleus-dependencies-component)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dbb1fa0339ba90a10441616affe3a84d5ccbda6ad041010a6d45b1941a40aa6a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272696768746e75636c6575732f646570656e64656e636965732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/brightnucleus/dependencies/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3d649032f2b9d1ff885858cc1b875d736109a95a62b369b47a7ac32e31f8219b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272696768746e75636c6575732f646570656e64656e636965732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/brightnucleus/dependencies/?branch=master)[![Build Status](https://camo.githubusercontent.com/e67b2672a180281f3976ade5fb973fc28feae422bed28ae4706146d54c3dab3a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272696768746e75636c6575732f646570656e64656e636965732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/brightnucleus/dependencies/build-status/master)[![Codacy Badge](https://camo.githubusercontent.com/d490526fd400ca964086567bf2b1f5d6d666a4f4da160e32d1988f9a54579ce7/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f67726164652f3166336164346562313535383464666261303430386339646530393430333566)](https://www.codacy.com/app/BrightNucleus/dependencies)[![Code Climate](https://camo.githubusercontent.com/ba97d1d3bfe2fc355fd6a84ff65219c420be6abff282036f8848d10c736e6df6/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6272696768746e75636c6575732f646570656e64656e636965732f6261646765732f6770612e737667)](https://codeclimate.com/github/brightnucleus/dependencies)

[![Latest Stable Version](https://camo.githubusercontent.com/13102b02de4315cb8706e80bf20464a40bbbcdede41d9318182ed2407268e78c/68747470733a2f2f706f7365722e707567782e6f72672f6272696768746e75636c6575732f646570656e64656e636965732f762f737461626c65)](https://packagist.org/packages/brightnucleus/dependencies)[![Total Downloads](https://camo.githubusercontent.com/b591c0f7a3ddac87c3c9620262c9dac88bc6f59ecb8aa0aeb995c8d2449ee52b/68747470733a2f2f706f7365722e707567782e6f72672f6272696768746e75636c6575732f646570656e64656e636965732f646f776e6c6f616473)](https://packagist.org/packages/brightnucleus/dependencies)[![Latest Unstable Version](https://camo.githubusercontent.com/bee59262705bc4a6ad2895578813ca10dc3b0c58e05376f2bc4e88faf8c7928b/68747470733a2f2f706f7365722e707567782e6f72672f6272696768746e75636c6575732f646570656e64656e636965732f762f756e737461626c65)](https://packagist.org/packages/brightnucleus/dependencies)[![License](https://camo.githubusercontent.com/0bf1574f5996e31e259bd00c749564b346c09eff77a7fc223d85c4261dcd535a/68747470733a2f2f706f7365722e707567782e6f72672f6272696768746e75636c6575732f646570656e64656e636965732f6c6963656e7365)](https://packagist.org/packages/brightnucleus/dependencies)

This is a WordPress dependencies component that lets you define dependencies through a config file. The dependencies you define in this way will then get registered and enqueued automatically.

Table Of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
    - [Configuration File](#configuration-file)
    - [Initialization](#initialization)
- [Advanced Features](#advanced-features)
    - [Conditional Registration](#conditional-registration)
    - [Localized Data](#localized-data)
    - [Inline Scripts](#inline-scripts)
    - [Custom Context Data](#custom-context-data)
    - [Manual Enqueueing](#manual-enqueueing)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

The best way to use this component is through Composer:

```
composer require brightnucleus/dependencies
```

Basic Usage
-----------

[](#basic-usage)

### Configuration File

[](#configuration-file)

To use the `DependencyManager`, you first need to create a config file ( see [`brightnucleus/config`](https://github.com/brightnucleus/config) ), in which you define your dependencies. At the root level of the config that is passed into the `DependencyManager`'s constructor, you'll have one key for each type of dependency, and a `handlers` key that defines the class that handles that specific type of dependency. As an example, here is the setup that the `DependencyManager` has out-of-the-box support for:

```
