PHPackages                             stellarwp/installer - 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. stellarwp/installer

ActiveLibrary

stellarwp/installer
===================

StellarWP plugin install/activation library.

1.1.1(2y ago)3568.1k↓28.9%2[1 issues](https://github.com/stellarwp/installer/issues)GPL-2.0-or-laterPHPPHP &gt;=7.2

Since Jan 28Pushed 2y ago17 watchersCompare

[ Source](https://github.com/stellarwp/installer)[ Packagist](https://packagist.org/packages/stellarwp/installer)[ RSS](/packages/stellarwp-installer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (14)Versions (10)Used By (0)

StellarWP Installer
===================

[](#stellarwp-installer)

[![CI](https://github.com/stellarwp/installer/workflows/Tests/badge.svg)](https://github.com/stellarwp/installer/actions?query=branch%3Amain) [![Static Analysis](https://github.com/stellarwp/installer/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/stellarwp/installer/actions/workflows/static-analysis.yml)

A library for installing / activating other plugins. Authored by the development team at StellarWP and provided free for the WordPress community.

- [Installation](#installation)
    - [Handling text domains](#handling-text-domains)
        - [If you are using Strauss from within your `vendor/bin` directory](#if-you-are-using-strauss-from-within-your-vendorbin-directory)
        - [If you are using Strauss as a `.phar` file](#if-you-are-using-strauss-as-a-phar-file-recommended)
- [Initialization](#initialization)
- [Registering a plugin](#registering-a-plugin)
    - [Simple registration](#simple-registration)
    - [Registration with download link](#registration-with-download-link)
    - [Registration with an action indicating that the plugin is active](#registration-with-an-action-indicating-that-the-plugin-is-active)
- [Rendering an install/activate button](#rendering-an-install-activate-button)
    - [Render a button](#render-a-button)
    - [Get a button](#get-a-button)
    - [Get or render a button and redirect](#get-or-render-a-button-and-redirect)
- [PHP - Actions](#php---actions)
- [PHP - Filters](#php---filters)
- [JS - Actions](#js---actions)

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

[](#installation)

It's recommended that you install Schema as a project dependency via [Composer](https://getcomposer.org/):

```
composer require stellarwp/installer
```

> We *actually* recommend that this library gets included in your project using [Strauss](https://github.com/BrianHenryIE/strauss).
>
> Luckily, adding Strauss to your `composer.json` is only slightly more complicated than adding a typical dependency, so checkout our [strauss docs](https://github.com/stellarwp/global-docs/blob/main/docs/strauss-setup.md).

### Handling text domains

[](#handling-text-domains)

This library has strings that are run through WordPress translation functions. Because of this, there's an extra step that needs to be taken to ensure that the placeholder `%TEXTDOMAIN%` is replaced with your project's text domain.

#### If you are using Strauss as a `.phar` file (recommended)

[](#if-you-are-using-strauss-as-a-phar-file-recommended)

```
"scripts": {
	"strauss": [
		"test -f ./bin/strauss.phar || curl -o bin/strauss.phar -L -C - https://github.com/BrianHenryIE/strauss/releases/download/0.13.0/strauss.phar",
		"vendor/stellarwp/installer/bin/set-domain domain=YOUR_PROJECTS_TEXT_DOMAIN",
		"@php bin/strauss.phar"
	]
}
```

#### If you are using Strauss from within your `vendor/bin` directory

[](#if-you-are-using-strauss-from-within-your-vendorbin-directory)

```
"scripts": {
    "strauss": [
      "vendor/stellarwp/installer/bin/set-domain domain=YOUR_PROJECTS_TEXT_DOMAIN",
      "vendor/bin/strauss"
    ]
}
```

Initialization
--------------

[](#initialization)

During the `plugins_loaded` action, initialize the installer.

```
namespace StellarWP\Installer\Config;
namespace StellarWP\Installer\Installer;

add_action( 'plugins_loaded', function () {
	Config::set_hook_prefix( 'boomshakalaka' );
	Installer::init();
} );
```

Registering a plugin
--------------------

[](#registering-a-plugin)

Registering plugins for installation should be done during (or after) the `plugins_loaded` action.

`$installer->register_plugin( $slug, $plugin_name, $download_link, $did_action );`

ParameterTypeDescription`$slug``string`**Required.** A simple slug for referring to your plugin.`$plugin_name``string`**Required.** The plugin name. This should ***not*** be translated. It must match what is in the plugin header docblock.`$download_link``string`The plugin download link. If this is omitted, it is assumed that the URL will come from WordPress.org plugin repository.`$did_action``string`If provided, the action will be checked with `did_action()` to indicate that the plugin is active.### Simple registration

[](#simple-registration)

```
use StellarWP\Installer\Installer;

add_action( 'plugins_loaded', function () {
	$installer = Installer::get();
	$installer->register_plugin( 'event-tickets', 'Event Tickets' );
} );
```

### Registration with download link

[](#registration-with-download-link)

```
use StellarWP\Installer\Installer;

add_action( 'plugins_loaded', function () {
	$installer = Installer::get();
	$installer->register_plugin( 'event-tickets', 'Event Tickets', 'https://example.com/event-tickets.zip' );
} );
```

### Registration with an action indicating that the plugin is active

[](#registration-with-an-action-indicating-that-the-plugin-is-active)

```
use StellarWP\Installer\Installer;

add_action( 'plugins_loaded', function () {
	$installer = Installer::get();
	$installer->register_plugin( 'event-tickets', 'Event Tickets', null, 'event_tickets_plugin_loaded' );
} );
```

Rendering an install/activate button
------------------------------------

[](#rendering-an-installactivate-button)

Buttons are the main point of this library. You can get or render a button. When you do, the relevant JavaScript will be enqueued to hook the button up with admin-ajax.php.

### Render a button

[](#render-a-button)

```
use StellarWP\Installer\Installer;

Installer::get()->render_plugin_button( 'event-tickets', 'install', 'Install Event Tickets' );
```

### Get a button

[](#get-a-button)

```
use StellarWP\Installer\Installer;

Installer::get()->get_plugin_button( 'event-tickets', 'install', 'Install Event Tickets' );
```

### Get or render a button and redirect

[](#get-or-render-a-button-and-redirect)

```
use StellarWP\Installer\Installer;

// Get it.
$button = Installer::get()->get_plugin_button( 'event-tickets', 'install', 'Install Event Tickets', $redirect_url );

// Or render it.
Installer::get()->render_plugin_button( 'event-tickets', 'install', 'Install Event Tickets', $redirect_url );
```

PHP - Actions
-------------

[](#php---actions)

### `stellarwp/installer/{$hook_prefix}/deregister_plugin`

[](#stellarwpinstallerhook_prefixderegister_plugin)

Fired when a plugin is deregistgered.

**Parameters**: *string* `$slug`

### `stellarwp/installer/{$hook_prefix}/register_plugin`

[](#stellarwpinstallerhook_prefixregister_plugin)

Fired after registering a plugin.

**Parameters**: *string* `$slug`, *string* `$plugin_name`, *string* `$download_link = null`, *string* `$did_action = null`

PHP - Filters
-------------

[](#php---filters)

### `stellarwp/installer/{$hook_prefix}/activated_label`

[](#stellarwpinstallerhook_prefixactivated_label)

Filters the label used for the "activated" button.

**Parameters**: *string* `$label`, *string* `$slug`, *StellarWP\\Installer\\Contracts\\Handler* `$handler`

**Default**: `Activated!`

```
use StellarWP\Installer;
$hook_prefix = Installer\Config::get_hook_prefix();

add_filter( "stellarwp/installer/{$hook_prefix}/activated_label", function ( $label, $slug, $handler ) {
	return 'Activated, yo.';
}, 10, 3 );
```

### `stellarwp/installer/{$hook_prefix}/activating_label`

[](#stellarwpinstallerhook_prefixactivating_label)

Filters the label used for the "activating" button.

**Parameters**: *string* `$label`, *string* `$slug`, *StellarWP\\Installer\\Contracts\\Handler* `$handler`

**Default**: `Activating...`

```
use StellarWP\Installer;
$hook_prefix = Installer\Config::get_hook_prefix();

add_filter( "stellarwp/installer/{$hook_prefix}/activating_label", function ( $label, $slug, $handler ) {
	return 'BOOM! Activating...';
}, 10, 3 );
```

### `stellarwp/installer/{$hook_prefix}/busy_class`

[](#stellarwpinstallerhook_prefixbusy_class)

Filters the class used for the "busy" state.

**Parameters**: *string* `$class`

**Default**: `is-busy`

```
use StellarWP\Installer;
$hook_prefix = Installer\Config::get_hook_prefix();

add_filter( "stellarwp/installer/{$hook_prefix}/busy_class", function ( $class ) {
	return 'is-very-busy';
} );
```

### `stellarwp/installer/{$hook_prefix}/button_classes`

[](#stellarwpinstallerhook_prefixbutton_classes)

Filters the classes used for the button.

**Parameters**: *array* `$classes`, *string* `$slug`, *StellarWP\\Installer\\Contracts\\Handler* `$handler`

**Default**: An array of default namespaced classes.

```
use StellarWP\Installer;
$hook_prefix = Installer\Config::get_hook_prefix();

add_filter( "stellarwp/installer/{$hook_prefix}/button_classes", function ( $classes, $slug, $handler ) {
	$classes[] = 'is-primary';
	$classes[] = 'some-other-class';
	return $classes;
}, 10, 3 );
```

### `stellarwp/installer/{$hook_prefix}/button_id`

[](#stellarwpinstallerhook_prefixbutton_id)

Filters the button id attribute for the button.

**Parameters**: *string* `$id`, *string* `$slug`, *StellarWP\\Installer\\Contracts\\Handler* `$handler`

**Default**: `null`

### `stellarwp/installer/{$hook_prefix}/download_url`

[](#stellarwpinstallerhook_prefixdownload_url)

Filters the download\_url used for the installation of the plugin.

### `stellarwp/installer/{$hook_prefix}/get_permission`

[](#stellarwpinstallerhook_prefixget_permission)

Filters the permissions used for the installation of the plugin.

### `stellarwp/installer/{$hook_prefix}/install_error_message`

[](#stellarwpinstallerhook_prefixinstall_error_message)

Filters the install error message.

### `stellarwp/installer/{$hook_prefix}/installed_label`

[](#stellarwpinstallerhook_prefixinstalled_label)

Filters the label used for the "installed" button.

**Parameters**: *string* `$label`, *string* `$slug`, *StellarWP\\Installer\\Contracts\\Handler* `$handler`

**Default**: `Installed!`

```
use StellarWP\Installer;
$hook_prefix = Installer\Config::get_hook_prefix();

add_filter( "stellarwp/installer/{$hook_prefix}/installed_label", function ( $label, $slug, $handler ) {
	return 'Installed, yo.';
}, 10, 3 );
```

### `stellarwp/installer/{$hook_prefix}/installing_label`

[](#stellarwpinstallerhook_prefixinstalling_label)

Filter the label used for the "installing" button.

**Parameters**: *string* `$label`, *string* `$slug`, *StellarWP\\Installer\\Contracts\\Handler* `$handler`

**Default**: `Installing...`

```
use StellarWP\Installer;
$hook_prefix = Installer\Config::get_hook_prefix();

add_filter( "stellarwp/installer/{$hook_prefix}/installing_label", function ( $label, $slug, $handler ) {
	return 'YAY! Installing...';
}, 10, 3 );
```

### `stellarwp/installer/{$hook_prefix}/nonce_name`

[](#stellarwpinstallerhook_prefixnonce_name)

The name of the nonce field that is used when interacting with an install/activate button.

### `stellarwp/installer/{$hook_prefix}/wordpress_org_data`

[](#stellarwpinstallerhook_prefixwordpress_org_data)

Filters the data returned from the WordPress.org plugin repository.

JS - Actions
------------

[](#js---actions)

### `stellarwp_installer_{$hook_prefix}_error`

[](#stellarwp_installer_hook_prefix_error)

Fires when an error occurs during the installation of a plugin.

```
wp.hooks.addAction( 'stellarwp_installer_HOOK_PREFIX_error', function( selector, slug, action, message, hookPrefix ) {
	alert( message );
} );
```

Acknowledgements
----------------

[](#acknowledgements)

Props to the folks at [The Events Calendar](https://theeventscalendar.com) for the efforts on the initial release of this library.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.7% 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 ~21 days

Recently: every ~32 days

Total

7

Last Release

1077d ago

Major Versions

0.2.1 → 1.0.02023-01-29

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/70a2847a265444714b48c64eceb3ca742baa3a56757ce65b18bd7bbbbf910312?d=identicon)[dpanta94](/maintainers/dpanta94)

![](https://www.gravatar.com/avatar/97fd764aa710e8d8263a7e3b3fececdfd736b8aad8055227bf592ddf50ad15ba?d=identicon)[stellarwp](/maintainers/stellarwp)

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

---

Top Contributors

[![borkweb](https://avatars.githubusercontent.com/u/430385?v=4)](https://github.com/borkweb "borkweb (52 commits)")[![bordoni](https://avatars.githubusercontent.com/u/236579?v=4)](https://github.com/bordoni "bordoni (4 commits)")[![EugeneKyale](https://avatars.githubusercontent.com/u/22029087?v=4)](https://github.com/EugeneKyale "EugeneKyale (2 commits)")

---

Tags

wordpress-librarywordpress-php-library

### Embed Badge

![Health badge](/badges/stellarwp-installer/health.svg)

```
[![Health](https://phpackages.com/badges/stellarwp-installer/health.svg)](https://phpackages.com/packages/stellarwp-installer)
```

PHPackages © 2026

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