axepress / axewp-common
Shared WordPress and WPGraphQL utilities for AxeWP plugins
v0.1.0
2026-07-21 22:49 UTC
Requires
- php: ^8.2
Requires (Dev)
- axepress/wp-graphql-cs: ^2.0.0
- axepress/wp-graphql-stubs: ^2.3.0
- php-stubs/wordpress-stubs: 7.0.1 as 6.9.4
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^2.2
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- szepeviktor/phpstan-wordpress: ^2.0
- wp-phpunit/wp-phpunit: ^7.0
- yoast/phpunit-polyfills: ^4.0
README
Shared WordPress and WPGraphQL utilities for AxeWP plugins.
axepress/axewp-common is a PHP library providing reusable base classes, interfaces, and traits used the AxePress suite of WordPress plugins.
Requirements
- PHP 8.2+
Installation
composer require axepress/axewp-common
What's Included
Core (src/Core/)
| Class / Trait | Description |
|---|---|
Config |
Hook prefix configuration for plugin integration |
AbstractEncryptor |
Base class for encryption utilities |
AssetLoaderTrait |
Script, style, and script-module registration |
AutoloaderTrait |
Custom class autoloading |
VIPHelpers |
Wrappers for VIP-only functions, with fallbacks |
GraphQL (src/GraphQL/)
Abstracts for registering WPGraphQL types with a consistent API:
Abstracts (src/GraphQL/Abstracts/)
| Abstract | GraphQL Type |
|---|---|
Type |
Base type with registration hooks |
ObjectType |
Object types with fields |
MutationType |
Mutation types |
InputType |
Input types |
EnumType |
Enum types |
UnionType |
Union types |
InterfaceType |
Interface types |
ConnectionType |
Connection types |
FieldsType |
Types with fields |
Interfaces (src/GraphQL/Interfaces/)
GraphQLType, TypeWithFields, TypeWithInputFields, TypeWithInterfaces, TypeWithConnections
Traits (src/GraphQL/Traits/)
TypeNameTrait, TypeResolverTrait
Contracts (src/Contracts/)
| Interface / Trait | Description |
|---|---|
Registrable |
Interface for classes that register hooks |
Singleton |
Trait implementing the singleton pattern |
Development
See DEVELOPMENT.md for the full setup, standards, and testing guide, and CONTRIBUTING.md before opening a PR.
Quick Start
# Install the NPM dependencies (using NVM) nvm use npm ci # Install the PHP dependencies (using Composer) composer install # Lints ## Prettier npm run format ## PHPCS npm run lint:php npm run lint:php:fix ## PHPStan npm run lint:php:stan ## TypeScript npm run lint:js:types
Testing
# Start the wp-env test environment with Xdebug code coverage enabled npm run wp-env:test start -- --xdebug=coverage # Run the PHPUnit tests npm run test:php