PHPackages                             axepress/wp-graphql-plugin-boilerplate - 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. [API Development](/categories/api)
4. /
5. axepress/wp-graphql-plugin-boilerplate

ActiveLibrary[API Development](/categories/api)

axepress/wp-graphql-plugin-boilerplate
======================================

Boilerplate for creating WPGraphQL extensions

0.1.1(11mo ago)1748.4k—1.5%3[1 issues](https://github.com/AxeWP/wp-graphql-plugin-boilerplate/issues)[2 PRs](https://github.com/AxeWP/wp-graphql-plugin-boilerplate/pulls)3GPL-3.0-or-laterPHPPHP &gt;=7.4CI passing

Since May 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/AxeWP/wp-graphql-plugin-boilerplate)[ Packagist](https://packagist.org/packages/axepress/wp-graphql-plugin-boilerplate)[ GitHub Sponsors](https://github.com/AxeWp)[ RSS](/packages/axepress-wp-graphql-plugin-boilerplate/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (16)Used By (3)

[![Logo](./assets/logo.png)](./assets/logo.png)

WPGraphQL Plugin Boilerplate
============================

[](#wpgraphql-plugin-boilerplate)

🚨 NOTE: This is prerelease software. Use at your own risk 🚨

A boilerplate for creating WPGraphQL extensions. Can be used as a Composer dependency or as a tool to scaffold your own plugin.

- [Join the WPGraphQL community on Slack.](https://join.slack.com/t/wp-graphql/shared_invite/zt-3vloo60z-PpJV2PFIwEathWDOxCTTLA)

Inspired by the following projects and their contributors:

- [WPGraphQL](https://github.com/wp-graphql/wp-graphql)
- [WPGraphQL BuddyPress](https://github.com/wp-graphql/wp-graphql-buddypress)
- [WPGraphQL for GravityForms](https://github.com/harness-software/wp-graphql-gravity-forms)
- [WPGraphQL for WooCommerce](https://github.com/wp-graphql/wp-graphql-woocommerce)

Features
--------

[](#features)

- Default folder structure that mirrors WPGraphQL.
- Helper classes, interfaces, methods, and traits to make it easier to register new GraphQL types.
- Dependency management with [Composer](https://getcomposer.org/).
- Code sniffing with [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer), [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/), and [Automattic's WordPress VIP Coding Standards](https://github.com/Automattic/VIP-Coding-Standards)
- Static Analysis with [PHPStan](https://phpstan.org/)
- WPUnit Testing with [Codeception](http://codeception.com/) and [WPBrowser](https://wpbrowser.wptestkit.dev/).
- [Docker](https://www.docker.com/) image generation.
- Automated CI with [Github Actions](https://github.com/features/actions).

System Requirements
-------------------

[](#system-requirements)

- PHP 7.4+ | 8.0+ | 8.1+
- WordPress 6.0+
- WPGraphQL 1.8.0+

Getting Started
---------------

[](#getting-started)

### As a Composer dependency

[](#as-a-composer-dependency)

We recommend installing this boilerplate using Strauss, to prevent plugin conflicts with other libraries. For more information see this [explainer from StellarWP](https://github.com/stellarwp/global-docs/blob/main/docs/strauss-setup.md).

#### 1. Add the dependency to your project.

[](#1-add-the-dependency-to-your-project)

```
composer require axewp/wp-graphql-plugin-boilerplate
```

#### 2. Configure Strauss.

[](#2-configure-strauss)

1. Add the following scripts to composer .json:

```
"scripts": {
  "pre-prefix-namespaces": [
    "test -d vendor-prefixed || mkdir vendor-prefixed",
    "test -f ./bin/strauss.phar || curl -o bin/strauss.phar -L -C - https://github.com/BrianHenryIE/strauss/releases/download/0.22.2/strauss.phar"
  ],
  "prefix-namespaces": [
    "@php bin/strauss.phar",
    "@composer dump-autoload"
  ],
  "pre-install-cmd": [
    "@pre-prefix-namespaces"
  ],
  "pre-update-cmd": [
    "@pre-install-cmd"
  ],
  "post-install-cmd": [
    "@prefix-namespaces"
  ],
  "post-update-cmd": [
    "@prefix-namespaces"
  ]
}
```

2. Add the strauss config to "extra" in composer.json:

```
"extra": {
  "strauss": {
    "target_directory": "vendor-prefixed",
    "namespace_prefix": "WPGraphQL\\PluginName\\Vendor\\",
    "classmap_prefix": "WPGraphQL_PluginName",
    "constant_prefix": "GRAPHQL_PLUGINNAME",
    "delete_vendor_packages": true,
    "include_modified_date": false,
    "update_call_sites": false,
    "exclude_from_prefix": {
      "namespaces": [],
      "file_patterns": []
    }
    "packages": [
      "axepress/wp-graphql-plugin-boilerplate"
    ],
  }
},
```

3. Include the autoloader in your composer.json's classmap.

```
"autoload": {
  "files": [
    "access-functions.php"
  ],
  "psr-4": {
    "WPGraphQL\\PluginName\\": "src/"
  },
+  "classmap": [
+    "vendor-prefixed/"
+  ]
},
```

### As a plugin starter

[](#as-a-plugin-starter)

#### 1. Initialize the plugin

[](#1-initialize-the-plugin)

Creating your WPGraphQL plugin is as simple as downloading the project to your machine and running `curl -fsSL https://raw.github.com/AxeWP/wp-graphql-plugin-boilerplate/master/bin/install.sh | bash`.

You will be asked to provide the following configuration details, or you can pass them as flags.

- **Branch (`--branch`)** : The Github branch to use as the source.
- **Name (`--name`)** : The name of your plugin (e.g. `My Plugin for WPGraphQL`).
- **Namespace (`--namespace`)**: The PHP namespace to be used for the plugin (e.g. `MyPlugin`).
- **Path (`--path`)**: The path to the directory directory where the plugin should be created (e.g. `mysite/wp-content/plugins`).
- **Prefix (`--prefix`)**: The plugin prefix (in snake case). This will be used to generate unique functions, hooks and constants (e.g. `my_plugin`).
- **Slug (`--slug`)**: The slug (in kebab-case) to use for the plugin (e.g. `wp-graphql-my-plugin`).

Alternatively, you can download the repository and run `composer create-plugin`.

#### 2. Create your `.env` file

[](#2-create-your-env-file)

Rename `.env.dist` to `.env`, and set the variables to your particular localhost/testing environment.

##### Project Structure

[](#project-structure)

```
wp-graphql-plugin-name                # This will be renamed by `create-plugin` to the provided slug.
├── .github/workflows
│   ├── code-quality.yml              # Github workflow for PHPStan.
│   ├── code-standard.yml             # Github workflow for PHPCS
│   ├── integration-testing.yml       # Github workflow for Codeception tests and Coveralls.
│   ├── schema-linter.yml             # Github workflow GraphQL schema linting.
│   └── upload-schema-artifact.yml    # Generates a schema artifact on Github release, for use by schema-linter.yml
├── .wordpress.org                    # Assets for use in WordPress's plugin directory.
├── bin
│   ├── _env.sh                       # The shared env variables used by other shell scripts.
│   ├── _lib.sh                       # Shared functions used by other shell scripts
│   ├── install-stan-env.sh           # Creates a development environment for running PHPStan.
│   ├── install-test-env.sh           # Creates a development environment for running Codeception.
│   ├── run-docker.sh                 # Builds and runs the Docker image.
│   └── wp-cli.yml                    # WPCLI configuration used for scripts.
├── docker
│   ├── app.Dockerfile
│   ├── app.entrypoint.sh
│   ├── app.post-setup.sh
│   ├── app.setup.sh
│   ├── testing.Dockerfile
│   └── testing.entrypoint.sh
├── phpstan
│   └── constants.php                 # Stubbed plugin constants for PHPStan.
├── src
│   ├── Admin                         # Classes for modifying the WP dashboard.
│   │   └── Settings
│   │       └── Settings.php          # Adds custom settings to WPGraphQL's settings page.
│   ├── Connection                    # GraphQL connections.
│   ├── Data
│   ├── Fields                        # Individual GraphQL fields.
│   ├── Model                         # GraphQL object data modelers.
│   ├── Mutation                      # GraphQL mutations
│   ├── Type                          # GraphQL types.
│   │   ├── Enum                      # Enum types.
│   │   ├── Input                     # Input types.
│   │   ├── Union                     # Union types.
│   │   ├── WPInterface               # Interface types.
│   │   └── WPObject                  # Object types.
│   ├── Utils                         # Helper functions used across the plugin
│   ├── CoreSchemaFilters.php         # Entrypoint for modifying the default schema provided by WPGraphQL
│   ├── Main.php                      # Bootstraps the plugin
│   └── TypeRegistry.php              # Entrypoint for registering GraphQL types to the schema
├── tests                             # Codeception tests
│   ├── _data
│   ├── _envs
│   ├── _output
│   ├── _support
│   ├── acceptance
│   ├── unit
│   ├── wpunit
│   ├── acceptance.suite.dist.yml
│   ├── bootstrap.php
│   ├── unit.suite.dist.yml
│   └── wpunit.suite.dist.yml
├── vendor                            # Composer dependencies
│  └── composer/autoload.php          # Composer autoloader
├── vendor-prefixed                   # Namespaced dependencies, including the wrapped AxeWP classes from this package.
├── .distignore
├── .env.dist
├── .gitattributes
├── .gitignore
├── .phpcs.xml.dist
├── access-functions.php              # Globally-available functions for accessing class methods.
├── activation.php                    # Methods that run on plugin activation.
├── codeception.dist.yml
├── composer.json
├── deactivation.php                  # Methods that run on plugin deactivation.
├── docker-compose.yml
├── LICENSE
├── phpstan.neon.dist
├── phpunit.xml.dist
├── README.md                         # The repo readme file.
├── readme.txt                        # The plugin readme file.
└── wp-graphql-plugin-name.php
```

Roadmap
-------

[](#roadmap)

- Include example files.
- Quality-of-life utils that make it easy to extend WPGraphQL.
- Extensive documentation.

Documentation
-------------

[](#documentation)

@todo

### Recipes

[](#recipes)

@todo

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance66

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.6% 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 ~111 days

Recently: every ~209 days

Total

11

Last Release

346d ago

PHP version history (3 changes)0.0.1PHP &gt;=7.4 || ^8.0

0.0.9PHP &gt;=7.4 || ^8.0 || ^8.1

0.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/33212bff2915bd72792772a2d3203abe0402352b6be6ba65081036f10560c6e6?d=identicon)[justlevine](/maintainers/justlevine)

---

Top Contributors

[![justlevine](https://avatars.githubusercontent.com/u/29322304?v=4)](https://github.com/justlevine "justlevine (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/axepress-wp-graphql-plugin-boilerplate/health.svg)

```
[![Health](https://phpackages.com/badges/axepress-wp-graphql-plugin-boilerplate/health.svg)](https://phpackages.com/packages/axepress-wp-graphql-plugin-boilerplate)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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