{"id":15685732,"url":"https://github.com/johnbillion/wp-compat","last_synced_at":"2025-10-14T11:05:29.504Z","repository":{"id":255442579,"uuid":"851865082","full_name":"johnbillion/wp-compat","owner":"johnbillion","description":"PHPStan extension to help verify that your plugin or theme remains compatible with its minimum supported version of WordPress","archived":false,"fork":false,"pushed_at":"2025-07-03T21:39:13.000Z","size":669,"stargazers_count":22,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"trunk","last_synced_at":"2025-09-28T20:51:37.659Z","etag":null,"topics":["phpstan","phpstan-extension","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnbillion.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"johnbillion"}},"created_at":"2024-09-03T20:31:38.000Z","updated_at":"2025-09-11T22:48:58.000Z","dependencies_parsed_at":"2024-09-09T21:24:44.987Z","dependency_job_id":"d6e281bd-5686-4df1-bc23-2e0ab2bcdc97","html_url":"https://github.com/johnbillion/wp-compat","commit_stats":null,"previous_names":["johnbillion/wp-compat"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/johnbillion/wp-compat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fwp-compat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fwp-compat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fwp-compat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fwp-compat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbillion","download_url":"https://codeload.github.com/johnbillion/wp-compat/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fwp-compat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018933,"owners_count":26086508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["phpstan","phpstan-extension","wordpress"],"created_at":"2024-10-03T17:29:47.133Z","updated_at":"2025-10-14T11:05:29.459Z","avatar_url":"https://github.com/johnbillion.png","language":"PHP","funding_links":["https://github.com/sponsors/johnbillion"],"categories":[],"sub_categories":[],"readme":"# WPCompat\n\nWPCompat is a PHPStan extension which helps verify that your PHP code is compatible with a given version of WordPress. You can use it to help ensure that your plugin or theme remains compatible with its \"Requires at least\" version.\n\nIt works by checking that any WordPress functions, class methods, actions, or filters that are in use were introduced prior to the minimum version of WordPress that your code supports. For example, if your plugin or theme supports WordPress 6.0 or higher but the `get_template_hierarchy()` function is used unconditionally, the extension will trigger an error because that function was only introduced in WordPress 6.1.\n\nIf your code is correctly guarded with a valid `function_exists()` or `method_exists()` check then an error won't be triggered.\n\n## Status\n\nVersion information was last updated for WordPress 6.8.\n\n## Requirements\n\n* PHPStan 2.0 or higher\n* PHP 7.4 or higher (tested up to PHP 8.4)\n\n## Installation\n\n```shell\ncomposer require --dev johnbillion/wp-compat\n```\n\nIf you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!\n\n\u003cdetails\u003e\n  \u003csummary\u003eManual installation\u003c/summary\u003e\n\nIf you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:\n\n```neon\nincludes:\n    - vendor/johnbillion/wp-compat/extension.neon\n```\n\u003c/details\u003e\n\n## Configuration\n\n### Themes\n\nIf your style.css file contains a \"Requires at least\" header then wp-compat will read this header and use its value as the minimum supported WordPress version. There is no need for any additional config.\n\n### Plugins\n\nIf the name of your main plugin file matches its parent directory -- for example `my-plugin/my-plugin.php` -- then wp-compat will read the \"Requires at least\" header from this file and use its value as the minimum supported WordPress version. There is no need for any additional config.\n\nIf your main plugin file is named otherwise or located elsewhere, you can specify its name in your PHPStan config file:\n\n```neon\nparameters:\n    WPCompat:\n        pluginFile: my-plugin.php\n```\n\n### Manual config\n\nAlternatively you can specify the minimum supported WordPress version number of your plugin or theme directly in your PHPStan config file. Note that this must be a string so it must be wrapped in quote marks.\n\n```neon\nparameters:\n    WPCompat:\n        requiresAtLeast: '6.0'\n```\n\nAny version number in `major.minor` or `major.minor.patch` format is accepted.\n\n## Ignoring errors\n\nYou can ignore an error from this extension by using its error identifier. For full information, see [the PHPStan guide to ignoring errors](https://phpstan.org/user-guide/ignoring-errors).\n\n### Functions and methods\n\nIf your code is correctly guarded with a valid `function_exists()` or `method_exists()` check then an error won't be triggered.\n\n```php\n// @phpstan-ignore WPCompat.functionNotAvailable\nwp_foo();\n\n// @phpstan-ignore WPCompat.methodNotAvailable\nWP::foo();\n```\n\n### Actions and filters\n\nThere is no concept of checking the existence of an action or filter in WordPress in order to guard its usage. You can still ignore an error for an action or filter using its error identifier, which contains a sanitized version of the hook name.\n\n```php\n// @phpstan-ignore WPCompat.filterNotAvailable.filtername\nadd_filter( 'filter_name', 'callback' );\n\n// @phpstan-ignore WPCompat.actionNotAvailable.myactionname\nadd_action( 'my_action_name', 'callback' );\n```\n\n## Technical details\n\nThis extension does not scan your project in order to detect the `@since` versions of WordPress functions, methods, and hooks. This information is included directly in the extension. This approach ensures that your code is always tested against the most up to date and most accurate `@since` documentation, regardless of the version of WordPress that your tests are using.\n\n### Functions and methods\n\nThe [symbols.json](symbols.json) file contains a dictionary of all functions and methods in WordPress along with the version of WordPress in which they were introduced.\n\nThe file can be regenerated by running:\n\n```shell\ncomposer generate\n```\n\nThe JSON schema for the file can be found in [schemas/symbols.json](schemas/symbols.json).\n\n### Actions and filters\n\nInformation about actions and filters is provided by [the `wp-hooks/wordpress-core` package](https://github.com/wp-hooks/wordpress-core-hooks).\n\n## Sponsors\n\n\u003cp align=\"center\"\u003eThe time that I spend maintaining this extension and others is in part sponsored by:\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://automattic.com\"\u003e\u003cimg src=\"https://cdn.jsdelivr.net/gh/johnbillion/johnbillion@latest/assets/sponsors/automattic.svg\" alt=\"Automattic\" width=\"50%\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://servmask.com\"\u003e\u003cimg src=\"https://cdn.jsdelivr.net/gh/johnbillion/johnbillion@latest/assets/sponsors/servmask.svg\" alt=\"ServMask\" width=\"25%\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003ePlus all my kind sponsors on GitHub:\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/sponsors/johnbillion\"\u003e\u003cimg src=\"https://cdn.jsdelivr.net/gh/johnbillion/johnbillion@latest/sponsors.svg\" alt=\"Sponsors\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/sponsors/johnbillion\"\u003eClick here to find out about supporting my open source tools and plugins\u003c/a\u003e.\u003c/p\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbillion%2Fwp-compat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbillion%2Fwp-compat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbillion%2Fwp-compat/lists"}