PHPackages                             devgeniem/dustpress-js - 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. [Framework](/categories/framework)
4. /
5. devgeniem/dustpress-js

ActiveWordpress-plugin[Framework](/categories/framework)

devgeniem/dustpress-js
======================

A DustPress plugin that provides a handy JavaScript library for using your DustPress Model methods on the front end.

4.4.3(3y ago)366.2k↓32.5%3[5 issues](https://github.com/devgeniem/dustpress-js/issues)[7 PRs](https://github.com/devgeniem/dustpress-js/pulls)GPL-3.0JavaScriptPHP &gt;=7.0

Since Jun 3Pushed 3y ago27 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (79)Used By (0)

[![geniem-github-banner](https://cloud.githubusercontent.com/assets/5691777/14319886/9ae46166-fc1b-11e5-9630-d60aa3dc4f9e.png)](https://cloud.githubusercontent.com/assets/5691777/14319886/9ae46166-fc1b-11e5-9630-d60aa3dc4f9e.png)

DustPress Plugin: DustPress.js
==============================

[](#dustpress-plugin-dustpressjs)

A DustPress plugin that provides a handy JavaScript library for using your DustPress model methods on the front end.

- Contributors: [devgeniem](https://github.com/devgeniem) / [Nomafin](https://github.com/Nomafin), [villesiltala](https://github.com/villesiltala), [godbone](https://github.com/godbone)
- Plugin url:
- Tags: dustpress, wordpress, plugins, dustjs, dust.js
- Requires at least: 4.9.0
- Requires DustPress version: 1.25.0
- Tested up to: 5.2.0
- License: GPL-3.0
- License URI:

Usage
-----

[](#usage)

You can call for `SomeModel`'s method `SomeMethod` with following code:

```
dp( 'SomeModel/SomeMethod', {
    tidy: true,
    args: {
        'foo': 'bar'
    }
}).then( ( data ) => {
    // do what you want with the data
}).catch( ( error ) => {
    // possible error
});
```

`tidy: true` parameter cleans up the data tree a bit for more usability. Feel free to try the queries with and without it to see the difference.

`args` parameter passes arguments to the PHP side. They can be accessed there with `$this->get_args();`.

If you want, you can even render HTML with Dust templates.

```
dp( 'SomeModel/SomeMethod', {
    partial: 'SomePartial',
}).then( ( data ) => {
    // do what you want with the data
}).catch( ( error ) => {
    // possible error
});
```

This code takes the data of `SomeMethod` and renders it with `SomePartial`. Variable `data` then contains the ready html.

If you still want to get the data output as well, use argument `data: true` and you will get the resulting data as the second parameter of your success function.

You can also omit the method completely if you want to get the data of a complete model.

```
dp( 'SomeModel/SomeMethod' ).then( ( data ) => {
    // do what you want with the data
}).catch( ( error ) => {
    // possible error
});
```

It is also possible to use the `dp` call with the async-await pattern:

```
try {
    var foobar = await dp( 'SomeModel/SomeMethod', {
        tidy: true,
        args: {
            foo: 'bar'
        }
    });
} catch( err ) {
    console.error( err );
}
```

Now data will consist of an object with the methods' names as keys and their return values as the values. Obviously you can also render that to HTML as well.

### Additional parameters

[](#additional-parameters)

#### bypassMainQuery

[](#bypassmainquery)

By default DustPress.js requests bypass WordPress' main WP\_Query so that it wouldn't slow the request down when it's not necessary. You can prevent that from happening by setting `bypassMainQuery: false` if you want to use the default query.

### Model function front-end visibility

[](#model-function-front-end-visibility)

You need to make your methods accessible for DustPress.js by defining a property named `$api` in your model. It should be an array consisting of the names of your accessible methods. DustPress.js can also run `protected` methods which are not automatically run by DustPress normally.

```
class SomeModel extends DustPressModel {
    public $api = [
        'SomeMethod'
    ];

    protected function SomeMethod() {
        // Some code..
    }
}

```

If you need to determine whether a call has been made from ajax or not, you can use `dustpress()->is_dustpress_ajax()` function like shown below:

```
class SomeModel extends DustPressModel {
    public $api = [
        'PublicMethod'
    ];

    public function PublicMethod() {
        if ( dustpress()->is_dustpress_ajax() ) {
            // Do not run if this an ajax request.
            return;
        }
        // Some code..
    }
}

```

Install
-------

[](#install)

Recommended installation to a WordPress project is through composer:

```
$ composer require devgeniem/dustpress-js

```

Obviously you can also download the ZIP file from GitHub and extract it into your plugins directory.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~53 days

Recently: every ~253 days

Total

48

Last Release

1131d ago

Major Versions

v2.3.1.x-dev → 3.0.32018-08-08

3.0.4 → 4.0.0-beta2019-01-25

3.0.5 → 4.0.02019-10-25

3.1.0 → 4.2.02020-02-28

3.1.1 → 4.4.32023-04-13

PHP version history (3 changes)0.1.0PHP &gt;=5.6

1.0.1PHP &gt;=5.4

2.0.2PHP &gt;=7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11960000?v=4)[Hion Digital Oy](/maintainers/devgeniem)[@devgeniem](https://github.com/devgeniem)

---

Top Contributors

[![godbone](https://avatars.githubusercontent.com/u/17048560?v=4)](https://github.com/godbone "godbone (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![Nomafin](https://avatars.githubusercontent.com/u/3604893?v=4)](https://github.com/Nomafin "Nomafin (5 commits)")[![arttu-makiporhola](https://avatars.githubusercontent.com/u/255447051?v=4)](https://github.com/arttu-makiporhola "arttu-makiporhola (3 commits)")[![ivuorinen](https://avatars.githubusercontent.com/u/11024?v=4)](https://github.com/ivuorinen "ivuorinen (3 commits)")[![Liblastic](https://avatars.githubusercontent.com/u/8523479?v=4)](https://github.com/Liblastic "Liblastic (3 commits)")

---

Tags

pluginframeworkwordpressjavascriptdebuggerthemedustjsdustpress

### Embed Badge

![Health badge](/badges/devgeniem-dustpress-js/health.svg)

```
[![Health](https://phpackages.com/badges/devgeniem-dustpress-js/health.svg)](https://phpackages.com/packages/devgeniem-dustpress-js)
```

###  Alternatives

[devgeniem/dustpress

WordPress Theme Framework.

5496.8k23](/packages/devgeniem-dustpress)[themosis/theme

The Themosis framework boilerplate theme.

10449.0k3](/packages/themosis-theme)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.7k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

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