PHPackages                             berry/extension-method-stub-generator - 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. berry/extension-method-stub-generator

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

berry/extension-method-stub-generator
=====================================

A composer plugin to generate berry extension method stubs

v0.2.0(5mo ago)09833MITPHPPHP &gt;=8.3

Since Jan 28Pushed 5mo agoCompare

[ Source](https://github.com/berry-php/extension-method-stub-generator)[ Packagist](https://packagist.org/packages/berry/extension-method-stub-generator)[ RSS](/packages/berry-extension-method-stub-generator/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (4)Used By (3)

Berry Extension Method Stub Generator
=====================================

[](#berry-extension-method-stub-generator)

A composer plugin to generate berry extension method stubs

How it works
------------

[](#how-it-works)

This composer plugin will scan all your dependencies for a file called `berry-method-extensions.json` and generate stubs in your project to be used by your IDE and phpstan

How to create stubs
-------------------

[](#how-to-create-stubs)

Here is an example we use at [berry/htmx](https://github.com/berry-php/htmx):

```
{
    "extensions": [
        {
            "namespace": "Berry\\Html",
            "class": [
                "HtmlTag",
                "HtmlVoidTag"
            ],
            "uses": [
                "Berry\\Htmx\\HxSwap",
                "Berry\\Htmx\\HxTarget"
            ],
            "methods": [
                {
                    "name": "hxGet",
                    "doc": "Issues a GET request to the specified URL",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxPost",
                    "doc": "Issues a POST request to the specified URL",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxPut",
                    "doc": "Issues a PUT request to the specified URL",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxPatch",
                    "doc": "Issues a PATCH request to the specified URL",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxDelete",
                    "doc": "Issues a DELETE request to the specified URL",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxBoost",
                    "doc": "Enables progressive enhancement",
                    "returns": "static",
                    "args": [
                        {
                            "type": "bool",
                            "name": "value"
                        }
                    ]
                },
                {
                    "name": "hxConfirm",
                    "doc": "Shows a confirm() dialog before issuing requests",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "message"
                        }
                    ]
                },
                {
                    "name": "hxDisable",
                    "doc": "Disables HTMX processing on this element and its children",
                    "returns": "static",
                    "args": []
                },
                {
                    "name": "hxEncoding",
                    "doc": "Changes encoding to multipart/form-data (\"multipart/form-data\")",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "type"
                        }
                    ]
                },
                {
                    "name": "hxExt",
                    "doc": "Extensions to include (comma-separated)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "extensions"
                        }
                    ]
                },
                {
                    "name": "hxHistory",
                    "doc": "Prevents history snapshot for this element",
                    "returns": "static",
                    "args": [
                        {
                            "type": "bool",
                            "name": "history"
                        }
                    ]
                },
                {
                    "name": "hxInclude",
                    "doc": "Additional elements to include in requests",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "selector"
                        }
                    ]
                },
                {
                    "name": "hxIndicator",
                    "doc": "CSS selector for indicator element",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "selector"
                        }
                    ]
                },
                {
                    "name": "hxParams",
                    "doc": "Filters parameters sent with requests",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "filter"
                        }
                    ]
                },
                {
                    "name": "hxPreserve",
                    "doc": "Preserves element across swaps",
                    "returns": "static",
                    "args": []
                },
                {
                    "name": "hxPrompt",
                    "doc": "Shows a prompt() before issuing requests",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "message"
                        }
                    ]
                },
                {
                    "name": "hxPushUrl",
                    "doc": "Pushes URL into history (\"true\" for current, \"false\" to disable)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string|bool",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxReplaceUrl",
                    "doc": "Replaces current URL without push",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string|bool",
                            "name": "url"
                        }
                    ]
                },
                {
                    "name": "hxRequest",
                    "doc": "Configures requests (JSON string)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "config"
                        }
                    ]
                },
                {
                    "name": "hxSelect",
                    "doc": "Selects content from response to swap",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "selector"
                        }
                    ]
                },
                {
                    "name": "hxSelectOob",
                    "doc": "Out-of-band swaps (comma-separated)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "values"
                        }
                    ]
                },
                {
                    "name": "hxSwapOob",
                    "doc": "Marks element for out-of-band swap",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string|bool",
                            "name": "swap"
                        }
                    ]
                },
                {
                    "name": "hxSync",
                    "doc": "Synchronizes requests on this element",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "strategy"
                        }
                    ]
                },
                {
                    "name": "hxTarget",
                    "doc": "Target element for response",
                    "returns": "static",
                    "args": [
                        {
                            "type": "HxTarget|string",
                            "name": "target"
                        }
                    ]
                },
                {
                    "name": "hxTrigger",
                    "doc": "Specifies trigger events",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "spec"
                        }
                    ]
                },
                {
                    "name": "hxValidate",
                    "doc": "Validates before request (\"true\")",
                    "returns": "static",
                    "args": [
                        {
                            "type": "bool",
                            "name": "true"
                        }
                    ]
                },
                {
                    "name": "hxVals",
                    "doc": "Adds extra values to requests (JSON)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "json"
                        }
                    ]
                },
                {
                    "name": "hxHeaders",
                    "doc": "Adds extra headers (JSON)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "json"
                        }
                    ]
                },
                {
                    "name": "hxSwap",
                    "doc": "Swap strategy for response",
                    "returns": "static",
                    "args": [
                        {
                            "type": "HxSwap|string",
                            "name": "strategy"
                        }
                    ]
                },
                {
                    "name": "hxDisinherit",
                    "doc": "Prevents inheriting specified attributes",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "attrs"
                        }
                    ]
                },
                {
                    "name": "hxInherit",
                    "doc": "Forces inheritance of specified attributes",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "attrs"
                        }
                    ]
                },
                {
                    "name": "hxHistoryElt",
                    "doc": "Marks element as the one saved to history",
                    "returns": "static",
                    "args": []
                },
                {
                    "name": "hxDisabledElt",
                    "doc": "Adds the disabled attribute to the specified elements while a request is in flight",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "selector"
                        }
                    ]
                },
                {
                    "name": "hxOn",
                    "doc": "Handles any event with inline script (uses hx-on:* syntax)",
                    "returns": "static",
                    "args": [
                        {
                            "type": "string",
                            "name": "event"
                        },
                        {
                            "type": "string",
                            "name": "js"
                        }
                    ]
                }
            ]
        }
    ]
}
```

Integrate with PHPStan
----------------------

[](#integrate-with-phpstan)

This tool also creates an extension.neon file you can just include in your phpstan config like this:

```
includes:
    - .berry/extension.neon

parameters:
    level: 10
    paths:
        - src/
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance72

Regular maintenance activity

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity42

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

Total

3

Last Release

155d ago

### Community

Maintainers

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

---

Top Contributors

[![atomicptr](https://avatars.githubusercontent.com/u/674705?v=4)](https://github.com/atomicptr "atomicptr (5 commits)")

---

Tags

berryberry-htmlcomposercomposer-plugin

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/berry-extension-method-stub-generator/health.svg)

```
[![Health](https://phpackages.com/badges/berry-extension-method-stub-generator/health.svg)](https://phpackages.com/packages/berry-extension-method-stub-generator)
```

###  Alternatives

[symfony/runtime

Enables decoupling PHP applications from global state

74798.8M1.0k](/packages/symfony-runtime)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5344.1M564](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2124.7M203](/packages/drupal-core-project-message)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

3014.6M26](/packages/vaimo-composer-patches)[sandersander/composer-link

Adds ability to link local packages for development with composer

98457.9k](/packages/sandersander-composer-link)[phpro/grumphp-shim

GrumPHP Phar distribution

294.7M340](/packages/phpro-grumphp-shim)

PHPackages © 2026

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