{"id":48718812,"url":"https://github.com/getdokan/wp-kit","last_synced_at":"2026-04-11T18:49:45.524Z","repository":{"id":342190263,"uuid":"1167387877","full_name":"getdokan/wp-kit","owner":"getdokan","description":"A structured WordPress toolkit for building plugins with a clean DataLayer (Model/DataStore), versioned migrations with background processing, object caching, and REST-powered admin notifications.","archived":false,"fork":false,"pushed_at":"2026-03-05T05:55:21.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-11T18:49:44.259Z","etag":null,"topics":["admin-notice","composer-package","data-layer","database-migrations","wordpress","wordpress-development","wordpress-plugin","wordpress-toolkit"],"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/getdokan.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-26T08:38:28.000Z","updated_at":"2026-03-05T05:55:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/getdokan/wp-kit","commit_stats":null,"previous_names":["getdokan/wp-kit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/getdokan/wp-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getdokan%2Fwp-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getdokan%2Fwp-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getdokan%2Fwp-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getdokan%2Fwp-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getdokan","download_url":"https://codeload.github.com/getdokan/wp-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getdokan%2Fwp-kit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31691503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["admin-notice","composer-package","data-layer","database-migrations","wordpress","wordpress-development","wordpress-plugin","wordpress-toolkit"],"created_at":"2026-04-11T18:49:44.825Z","updated_at":"2026-04-11T18:49:45.519Z","avatar_url":"https://github.com/getdokan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WPKit\n\nA standalone WordPress toolkit providing **DataLayer**, **Migration**, **Cache**, and **Admin Notification** components for plugin development — without requiring WooCommerce.\n\n## Requirements\n\n- PHP 7.4+\n- WordPress 5.9+\n\n## Installation\n\n\n### Step 1: Add to Your Project\n\nAdd the package to your `composer.json` dependencies:\n\n**Option A: Via GitHub (Recommended)**\n```json\n{\n  \"repositories\": [\n    {\n        \"type\": \"vcs\",\n        \"url\": \"https://github.com/getdokan/wp-kit.git\"\n    }\n  ]\n}\n```\n\n**Option B: Local Development**\nIf you are developing locally and want to link the package:\n```json\n{\n  \"repositories\": [\n    {\n        \"type\": \"path\",\n        \"url\": \"file:../path/to/wp-kit\"\n    }\n  ]\n}\n```\n\nNow run the following command\n\n```bash\ncomposer require wedevs/wp-kit\n```\n\n## Components\n\n| Component | Namespace | Description |\n|-----------|-----------|-------------|\n| **Cache** | `WeDevs\\WPKit\\Cache` | Object caching with group invalidation, built on `wp_cache_*` |\n| **DataLayer** | `WeDevs\\WPKit\\DataLayer` | Model + DataStore CRUD pattern with SQL builder and type casting |\n| **Migration** | `WeDevs\\WPKit\\Migration` | Version-based migration registry, schema helpers, background processing |\n| **AdminNotification** | `WeDevs\\WPKit\\AdminNotification` | Notice management with providers, dismissal, and REST API |\n\n## Quick Start\n\n```php\nuse WeDevs\\WPKit\\DataLayer\\DataLayerFactory;\nuse WeDevs\\WPKit\\Migration\\{MigrationRegistry, MigrationManager, MigrationHooks};\nuse WeDevs\\WPKit\\AdminNotification\\{NoticeManager, DismissalHandler};\n\n// DataLayer\nDataLayerFactory::init( 'myplugin' );\nDataLayerFactory::register_store( MyModel::class, MyDataStore::class );\n\n// Migration\n$registry = new MigrationRegistry( 'myplugin_db_version', MYPLUGIN_VERSION );\n$registry-\u003eregister_many( [ '1.0.0' =\u003e V_1_0_0::class ] );\n$manager = new MigrationManager( $registry, 'myplugin' );\n( new MigrationHooks( $manager, 'myplugin' ) )-\u003eregister();\n\n// Admin Notifications\n$notices = new NoticeManager( 'myplugin' );\n( new DismissalHandler( 'myplugin' ) )-\u003eregister();\n```\n\nSee [docs/developer-guide.md](docs/developer-guide.md) for full documentation.\n\n## Contributing\n\n### Setting Up the Development Environment\n\n1. Clone the repository:\n\n```bash\ngit clone git@github.com:wedevs/wp-kit.git\ncd wp-kit\n```\n\n2. Install dependencies:\n\n```bash\ncomposer install\n```\n\n### Project Structure\n\n```\nwp-kit/\n├── src/\n│   ├── Cache/                  # Caching layer (WPCacheEngine, ObjectCache)\n│   │   └── Contracts/          # CacheEngineInterface\n│   ├── DataLayer/              # Model + DataStore CRUD\n│   │   ├── Bridge/             # Optional WooCommerce adapters\n│   │   ├── Contracts/          # ModelInterface, DataStoreInterface\n│   │   ├── DataStore/          # BaseDataStore, SqlQuery\n│   │   └── Model/              # BaseModel\n│   ├── Migration/              # Version-based migrations\n│   │   └── Contracts/          # MigrationInterface\n│   └── AdminNotification/      # Admin notice system\n│       └── Contracts/          # NoticeProviderInterface\n├── tests/\n│   ├── bootstrap.php\n│   └── phpunit/\n│       └── tests/              # Test files mirror src/ structure\n├── docs/\n│   └── developer-guide.md\n├── composer.json\n└── phpunit.xml.dist\n```\n\n### Coding Standards\n\n- Follow [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) for PHP.\n- Use tabs for indentation.\n- All classes must be under the `WeDevs\\WPKit` namespace with PSR-4 autoloading.\n- Interfaces go in `Contracts/` subdirectories and are suffixed with `Interface`.\n- Abstract base classes are prefixed with `Base` (e.g., `BaseModel`, `BaseDataStore`).\n- All hook names and option keys must use the consumer-provided prefix — never hardcode a package-level prefix.\n\n### Running Tests\n\nThe test suite uses [PHPUnit](https://phpunit.de/) with [Brain Monkey](https://brain-wp.github.io/BrainMonkey/) for WordPress function mocking and [Mockery](https://docs.mockery.io/) for class mocking.\n\n```bash\n# Run the full test suite\ncomposer test\n\n# Run a specific test file\nvendor/bin/phpunit --filter BaseModelTest\n\n# Run tests with coverage (requires Xdebug or PCOV)\nvendor/bin/phpunit --coverage-text\n```\n\n### Writing Tests\n\nTests live in `tests/phpunit/tests/` and mirror the `src/` directory structure:\n\n```\nsrc/Cache/WPCacheEngine.php       → tests/phpunit/tests/Cache/WPCacheEngineTest.php\nsrc/DataLayer/Model/BaseModel.php → tests/phpunit/tests/DataLayer/BaseModelTest.php\n```\n\nAll test classes extend `WeDevs\\WPKit\\Tests\\TestCase`, which sets up Brain Monkey automatically.\n\n**Key conventions:**\n\n- One test class per source class, suffixed with `Test`.\n- Test method names follow `test_\u003cbehavior_being_tested\u003e` format.\n- Use Brain Monkey's `Functions\\when()` for stubs, `Functions\\expect()` for verifiable expectations.\n- For WordPress hooks, prefer `Brain\\Monkey\\Actions\\expectDone()` and `Brain\\Monkey\\Filters\\expectApplied()` over `Functions\\expect('do_action')`.\n- Use Mockery for class mocks (interfaces, data stores).\n\n**Example:**\n\n```php\n\u003c?php\n\nnamespace WeDevs\\WPKit\\Tests\\MyComponent;\n\nuse WeDevs\\WPKit\\Tests\\TestCase;\nuse Brain\\Monkey\\Functions;\n\nclass MyClassTest extends TestCase {\n\n    protected function setUp(): void {\n        parent::setUp();\n        // Stub WordPress functions as needed.\n        Functions\\when( 'absint' )-\u003ealias( fn( $val ) =\u003e abs( (int) $val ) );\n    }\n\n    public function test_it_does_something(): void {\n        Functions\\expect( 'get_option' )\n            -\u003ewith( 'my_option', [] )\n            -\u003eonce()\n            -\u003eandReturn( [ 'value' ] );\n\n        // ... test logic and assertions\n    }\n}\n```\n\n### Submitting Changes\n\n1. **Create a feature branch** from `main`:\n\n```bash\ngit checkout -b feature/my-change\n```\n\n2. **Make your changes** following the coding standards above.\n\n3. **Add or update tests** for any new or changed functionality. All new code must have corresponding tests.\n\n4. **Run the test suite** and ensure all tests pass:\n\n```bash\nvendor/bin/phpunit\n```\n\n5. **Commit your changes** with a clear, descriptive message:\n\n```bash\ngit commit -m \"Add support for batch model creation in BaseDataStore\"\n```\n\n6. **Push and open a pull request** against `main`:\n\n```bash\ngit push origin feature/my-change\n```\n\n### Pull Request Guidelines\n\n- Keep PRs focused — one feature or fix per PR.\n- Include a description of what changed and why.\n- Reference any related issues.\n- Ensure the test suite passes with no errors or failures.\n- New public APIs must include PHPDoc blocks.\n- Breaking changes must be clearly documented in the PR description.\n\n### Reporting Issues\n\nOpen an issue on GitHub with:\n\n- A clear title and description.\n- Steps to reproduce (if applicable).\n- Expected vs actual behavior.\n- PHP and WordPress versions.\n\n## License\n\nGPL-2.0-or-later\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetdokan%2Fwp-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetdokan%2Fwp-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetdokan%2Fwp-kit/lists"}