PHPackages                             miguelcolmenares/cf7-stubs - 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. miguelcolmenares/cf7-stubs

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

miguelcolmenares/cf7-stubs
==========================

Contact Form 7 function and class declaration stubs for static analysis

v6.1.3.1(4mo ago)11.4k↓50%MITPHPPHP ^7.4 || ^8.0CI passing

Since Nov 17Pushed 2mo agoCompare

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

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

Contact Form 7 Stubs
====================

[](#contact-form-7-stubs)

[![Packagist](https://camo.githubusercontent.com/68f173ee65e38328fb3845e71da6145a128c4d88ed7a01f6128f5866058e01a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696775656c636f6c6d656e617265732f6366372d73747562732e7376673f636f6c6f723d344343363145267374796c653d706f706f7574)](https://packagist.org/packages/miguelcolmenares/cf7-stubs)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Provides stub declarations for [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) functions, classes, interfaces, and traits. These stubs can help plugin and theme developers leverage static analysis tools like [PHPStan](https://github.com/phpstan/phpstan) and [Psalm](https://psalm.dev/).

The package includes two files:

- `contact-form-7-stubs.php` - Auto-generated stubs from Contact Form 7 source code
- `contact-form-7-types.php` - Additional constants and type definitions

> **Note:** The auto-generated stubs may have some PHPStan errors due to missing type hints in the original CF7 code. Including `contact-form-7-types.php` helps reduce these errors by providing essential constants like `MB_IN_BYTES`.

**Current version:** Contact Form 7 6.1.3

**Stubs include:**

- 308 functions
- 66 classes
- 8 traits
- 0 interfaces

The stubs are generated directly from the Contact Form 7 plugin source code using [php-stubs/generator](https://github.com/php-stubs/generator).

Requirements
------------

[](#requirements)

- PHP 7.4 or 8.0+

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

[](#installation)

Require this package as a development dependency with [Composer](https://getcomposer.org).

```
composer require --dev miguelcolmenares/cf7-stubs
```

Alternatively you may download `contact-form-7-stubs.php` directly.

Usage with PHPStan
------------------

[](#usage-with-phpstan)

```
composer require --dev szepeviktor/phpstan-wordpress
```

The package [`szepeviktor/phpstan-wordpress`](https://github.com/szepeviktor/phpstan-wordpress) depends on [`phpstan/phpstan`](http://github.com/phpstan/phpstan) and WordPress stubs. Then include the Contact Form 7 stubs in your PHPStan configuration:

```
# phpstan.neon.dist
parameters:
    bootstrapFiles:
        - vendor/miguelcolmenares/cf7-stubs/contact-form-7-stubs.php
        - vendor/miguelcolmenares/cf7-stubs/contact-form-7-types.php
```

**Note:** Make sure WordPress stubs are loaded before Contact Form 7 stubs, as CF7 depends on WordPress classes. The `contact-form-7-types.php` file provides additional type annotations that improve static analysis accuracy.

Usage with Psalm
----------------

[](#usage-with-psalm)

Update your Psalm config to include this section:

```

```

Furthermore, ensure Contact Form 7 plugin files are *not* included in ``.

Usage in Intellisense
---------------------

[](#usage-in-intellisense)

If your IDE has trouble parsing Contact Form 7, you may find the stubs useful for enabling code completion and related features. For example, there are [instructions](https://github.com/bmewburn/vscode-intelephense/issues/113) for usage with VSCode's [Intelephense](https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client) extension.

Versioning
----------

[](#versioning)

This package is versioned to match the Contact Form 7 version from which the stubs are generated.

Generating stubs for a different Contact Form 7 version
-------------------------------------------------------

[](#generating-stubs-for-a-different-contact-form-7-version)

1. Run a modern PHP version (7.4+)
2. Clone this repository and `cd` into it
3. Update the version in `source/composer.json`:

    ```
    "contact-form-7/contact-form-7": "x.x.x"
    ```

    And update the download URL:

    ```
    "url": "https://downloads.wordpress.org/plugin/contact-form-7.x.x.x.zip"
    ```
4. Run `composer update` in the `source` directory (or delete `source/contact-form-7` to force re-download)
5. Run `./generate.sh` from the root directory

The `contact-form-7-stubs.php` file should now be updated.

Trademark Notice
----------------

[](#trademark-notice)

"Contact Form 7" is a trademark of Rock Lobster, LLC. This project is not affiliated with, endorsed by, or sponsored by Rock Lobster, LLC or the Contact Form 7 project. This is an independent tool created to provide static analysis support for developers using the Contact Form 7 plugin.

For more information, see the [Contact Form 7 Trademark Policy](https://contactform7.com/trademark-policy/).

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance81

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~28 days

Total

2

Last Release

149d ago

### Community

Maintainers

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

---

Top Contributors

[![miguelcolmenares](https://avatars.githubusercontent.com/u/1714344?v=4)](https://github.com/miguelcolmenares "miguelcolmenares (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")

---

Tags

composercomposer-packagecontact-form-7phpstanwordpresswordpress-pluginPHPStanwordpressstatic analysisstubscontact-form-7cf7definitions

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/miguelcolmenares-cf7-stubs/health.svg)

```
[![Health](https://phpackages.com/badges/miguelcolmenares-cf7-stubs/health.svg)](https://phpackages.com/packages/miguelcolmenares-cf7-stubs)
```

###  Alternatives

[php-stubs/wordpress-stubs

WordPress function and class declaration stubs for static analysis.

19013.0M263](/packages/php-stubs-wordpress-stubs)[php-stubs/woocommerce-stubs

WooCommerce function and class declaration stubs for static analysis.

942.9M66](/packages/php-stubs-woocommerce-stubs)[php-stubs/wp-cli-stubs

WP-CLI function and class declaration stubs for static analysis.

302.3M79](/packages/php-stubs-wp-cli-stubs)[woocommerce/woocommerce-sniffs

WooCommerce sniffs

496.8M42](/packages/woocommerce-woocommerce-sniffs)[php-stubs/wordpress-globals

Global variables and global constants from WordPress core.

13799.0k17](/packages/php-stubs-wordpress-globals)[johnbillion/wp-compat

PHPStan extension to help verify that your PHP code is compatible with a given version of WordPress

24115.0k10](/packages/johnbillion-wp-compat)

PHPackages © 2026

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