{"id":15292215,"url":"https://github.com/getmindspun/wordpress-plugin-framework","last_synced_at":"2025-04-13T11:11:09.781Z","repository":{"id":65168180,"uuid":"582709489","full_name":"getmindspun/wordpress-plugin-framework","owner":"getmindspun","description":"A framework for professional-grade WordPress plugins.","archived":false,"fork":false,"pushed_at":"2024-08-24T15:13:25.000Z","size":99,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T02:21:28.439Z","etag":null,"topics":["wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getmindspun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-12-27T16:41:02.000Z","updated_at":"2024-08-24T15:09:50.000Z","dependencies_parsed_at":"2024-05-14T15:28:24.110Z","dependency_job_id":"d22c0b32-73e4-4614-abde-22a3d4901878","html_url":"https://github.com/getmindspun/wordpress-plugin-framework","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"7d78ba2e74c73da229f2d753097bdda8748cd70e"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmindspun%2Fwordpress-plugin-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmindspun%2Fwordpress-plugin-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmindspun%2Fwordpress-plugin-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmindspun%2Fwordpress-plugin-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getmindspun","download_url":"https://codeload.github.com/getmindspun/wordpress-plugin-framework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703198,"owners_count":21148118,"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","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":["wordpress","wordpress-plugin"],"created_at":"2024-09-30T16:16:59.943Z","updated_at":"2025-04-13T11:11:09.749Z","avatar_url":"https://github.com/getmindspun.png","language":"PHP","readme":"# WordPress Plugin Framework (wpfw)\n\nThe WordPress plugin framework utilizes the registry and facade design patterns to create profession-grade plugins that:\n* Have a clean, easy to understand, OOP implementation.\n* Have 100% unit test coverage.\n\nSee the `examples` directory for a batteries-included example.\n\n## Installation\nThe code is simple enough - and licensed appropriately - to be copied into your product directly, however, the best \napproach is to use Composer and [Strauss](https://github.com/BrianHenryIE/strauss).\n\nSee the `examples` directory for complete plugin that uses this method.\n\n### Autoloading\nThis package also contains a simple autoloader class that support both WordPress and PSR-4 style classes.\nUse it to autoload your application code.\n\n```\nrequire_once( __DIR__ . '/vendor-prefixed/autoload.php' );\nAutoloader::autoload( 'Examples\\Logging', __DIR__ . '/includes' );\n```\nThe first line pulls in the Strauss autoloader, which loads the framework - including\nour autoloader class.  The second line loads our plugin code.\n\nThe autoload method registers a namespace and associates the directory containing the files.\n```\nautoload( string $namespace, string $dir, string $type = 'psr4' )\n```\nThe `$type` parameter also accepts `wordpress` or `wp` in which case the WordPress file namings\nscheme is used - i.e. with 'class-' filenames etc.\n\n## Usage\nThe facade/provider combo acts as a mini-library inside your plugin.\nThe facade is the sole way the rest of the application acts with the functionality the provider provides.\n\nIn the plugin file, you'd call:\n```shell\nMyComponentProvider::provide();\n```\nthen in the rest of the application, use the facade:\n```shell\nMyComponent::my_method();\n```\n\n## Globals Facade/Provider\nThe framework contains one 'built-in' facade/provider combo: 'Globals', since every \nplugin is going to need it.\n\nIn your plugin, replace any call to a global function - either PHP native, or WordPress defined - with this facade.\nFor example, `die()` becomes `Globals::die()`, `wp_redirect(...)` becomes `Globals::wp_redirect(...)`\netc.\n\nGenerally, you'd create a 'Globals' class in your own namespace that \nextends `Mindspun\\Framework\\Facades\\Globals` and then has an empty body.\nThe purpose of this class is to add PHP doc `@method` comments with the globals you use\nto assist your editor.  See the 'Globals' class in the 'examples' directory for an example.\n\n## Motivation\nThere are at least six other GitHub projects with the name 'wordpress-plugin-framework', so why one more?\n\n* It's just plain difficult to get 100% code coverage for a plugin of any complexity, and we consider that a minimum\nrequirement for release.  This approach fixes that.\n* Just look at any of the older plugins on [wordpress.org/plugins/,](https://wordpress.org/plugins/)\nand you'll see that it's really difficult to prevent a plugin from turning into spaghetti code as it grows. This approach prevents that (mostly, care must still be taken).\n\n## Development\n\n### Setup\n\n```shell\ncomposer update\nmake\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetmindspun%2Fwordpress-plugin-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetmindspun%2Fwordpress-plugin-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetmindspun%2Fwordpress-plugin-framework/lists"}