PHPackages                             alanef/free\_plugin\_lib - 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. alanef/free\_plugin\_lib

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

alanef/free\_plugin\_lib
========================

Library to add to free plugins, in compliance with wp.org

1.2.3(4mo ago)0234GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Feb 13Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/alanef/free_plugin_lib)[ Packagist](https://packagist.org/packages/alanef/free_plugin_lib)[ RSS](/packages/alanef-free-plugin-lib/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (8)Used By (0)

Free Plugin Library for WordPress
=================================

[](#free-plugin-library-for-wordpress)

This library is designed to be integrated into free WordPress plugins, providing essential features such as opt-in forms, settings page management, and promotional content for premium plugins. It is distributed via **Packagist** and complies with WordPress.org guidelines.

---

Features
--------

[](#features)

- **Opt-in Form**: Allows users to opt-in to email lists for updates, tips, and exclusive offers.
- **Settings Page Management**: Adds a settings link to the plugin action links and redirects users to the settings page upon activation.
- **Promotional Content**: Displays ads for related premium plugins on the settings page, encouraging users to upgrade.
- **Compliance**: Ensures compliance with WordPress.org guidelines, including explicit consent for data collection and clear privacy policies.

---

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

[](#installation)

This library is available via **Packagist**. To install it in your WordPress plugin, use Composer:

```
composer require alanef/free_plugin_lib
```

When you build for plugin release use `composer update --no-dev` flag ensures that only production-ready code is installed, excluding development assets like tests and CI configurations.

---

Usage
-----

[](#usage)

### Initialization

[](#initialization)

To use the library, initialize it in your plugin's main file. You can instantiate it on any hook (e.g., `plugins_loaded`):

```
use Fullworks_Free_Plugin_Lib\Main;

add_action('plugins_loaded', function() {
    new Main(
        __FILE__,                                      // plugin_file
        'options-general.php?page=your-plugin-settings', // settings_page URL
        'your_plugin_shortname',                       // plugin_shortname (unique identifier)
        'your-plugin-page',                            // page slug
        'Your Plugin Name'                             // display name
    );
});
```

### Opt-in Form

[](#opt-in-form)

The library automatically handles the opt-in form display using a non-intrusive approach:

1. **Admin Notice**: A dismissible notice appears on the dashboard, plugins page, and your plugin's settings page prompting users to complete setup
2. **First Settings Visit**: When users first visit your plugin's settings page, they are redirected to the opt-in form
3. **User Choice**: Users can opt-in, skip, or dismiss the notice - the plugin works regardless of their choice

### Settings Page

[](#settings-page)

The library adds a settings link to the plugin action links. The opt-in prompt appears on first use, not on activation, ensuring it works with all activation methods (UI, WP-CLI, bulk activation, etc.).

### Promotional Content

[](#promotional-content)

The library displays ads for premium plugins on the settings page. Ensure that the `Advert` class is correctly initialized and that the premium plugin check logic is in place.

---

Hooks and Filters
-----------------

[](#hooks-and-filters)

### Actions

[](#actions)

- `admin_menu`: Adds the settings page to the WordPress admin menu.
- `admin_notices`: Displays setup prompt notice on dashboard, plugins page, and settings page.
- `init`: Loads the text domain for localization.
- `admin_enqueue_scripts`: Enqueues necessary scripts and styles for the settings page.
- `ffpl_ad_display`: Displays promotional content for premium plugins.

### Filters

[](#filters)

- `plugin_action_links`: Adds a settings link to the plugin action links.
- `ffpl_plugin_map`: Allows adding custom plugin shortnames to the verification endpoint mapping.
- `ffpl_verify_url`: Allows overriding the verification endpoint URL (useful for testing).

---

Localization
------------

[](#localization)

The library supports localization. Translation files should be placed in the `languages` directory and named according to the text domain (`free-plugin-lib`).

Example:

```
languages/free-plugin-lib-en_US.mo
languages/free-plugin-lib-en_US.po

```

---

Compliance
----------

[](#compliance)

The library is designed to comply with WordPress.org guidelines, including:

- **Explicit Consent**: No data is sent to external servers without explicit user consent.
- **No Automatic Downloads**: No software is downloaded or installed without user consent.
- **Clear Privacy Policy**: The opt-in form includes a link to the privacy policy.

---

Contributing
------------

[](#contributing)

Contributions are welcome! If you'd like to contribute to the development of this library, follow these steps:

1. Fork the repository.
2. Clone your fork locally: ```
    git clone https://github.com/your-username/free_plugin_lib.git
    ```
3. Install development dependencies: ```
    composer install
    ```
4. Make your changes and run tests: ```
    vendor/bin/phpunit
    ```
5. Submit a pull request with your changes.

---

License
-------

[](#license)

This library is licensed under the **GPL-2.0-or-later** license. See the [LICENSE](LICENSE) file for more details.

---

Support
-------

[](#support)

For support, please open an issue on the [GitHub repository](https://github.com/alanef/free_plugin_lib) or contact the maintainer directly.

---

Changelog
---------

[](#changelog)

For a detailed list of changes, see the [CHANGELOG](CHANGELOG.md).

---

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance78

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Recently: every ~5 days

Total

7

Last Release

138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3686c465c34ede89ec27b0ae1d6c270d66aab3e44643c49f5f5e67eeb5833a67?d=identicon)[alanef](/maintainers/alanef)

---

Top Contributors

[![alanef](https://avatars.githubusercontent.com/u/15021240?v=4)](https://github.com/alanef "alanef (62 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alanef-free-plugin-lib/health.svg)

```
[![Health](https://phpackages.com/badges/alanef-free-plugin-lib/health.svg)](https://phpackages.com/packages/alanef-free-plugin-lib)
```

###  Alternatives

[armincms/option

The armincms option package.

152.4k3](/packages/armincms-option)

PHPackages © 2026

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