Skip to content
PHPStan-compatible stub declarations for the Freemius SDK — enables full static analysis for WordPress plugins that mone...

2023 · Creator & Maintainer

Freemius SDK PHP Stubs

PHPStan-compatible stub declarations for the Freemius SDK — enables full static analysis for WordPress plugins that monetise via Freemius.

The challenge

Plugins monetised via Freemius can't run PHPStan above level 0 because Freemius SDK classes aren't visible to static analysis. Type-safety stops at the paywall code.

The result

A complete stub package for the Freemius SDK enabling PHPStan level 8 across the whole plugin — including the licensing, paywall, and analytics surface.

Year
2023
Role
Creator & Maintainer
Stack
4 teches
Status
Published

Overview

Freemius is the most widely-used SDK for selling and licensing WordPress plugins. This package provides PHPStan stub declarations for all public Freemius classes, methods, and functions — enabling type-safe development against the SDK without requiring the full Freemius codebase as a dev dependency.

Usage

BASH
composer require --dev mralaminahamed/freemius-stubs

Add to phpstan.neon:

YAML
parameters:
    stubFiles:
        - vendor/mralaminahamed/freemius-stubs/stubs

What's Included

  • Freemius, FS_Plugin, FS_User, FS_Site and all related class stubs
  • License management and pricing plan API stubs
  • Hooks and filter signatures

Adoption

Over 1,500 Composer installs across WordPress plugin development teams.

Tech

PHP, PHPStan stubs, Freemius SDK.

Share
𝕏 in

Related work

Building something similar?

Let's talk about your project.

Open to freelance engagements and consulting on Laravel, WordPress, and AI-powered systems.