{"id":26256739,"url":"https://github.com/orkan/wp-base","last_synced_at":"2025-03-13T20:19:05.035Z","repository":{"id":239331932,"uuid":"799220613","full_name":"orkan/wp-base","owner":"orkan","description":"WordPress plugin boilerplate","archived":false,"fork":false,"pushed_at":"2024-05-17T14:41:26.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-17T16:13:17.745Z","etag":null,"topics":["boilerplate","class","extend","framework","plugin","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orkan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"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}},"created_at":"2024-05-11T13:50:55.000Z","updated_at":"2024-08-05T17:11:32.313Z","dependencies_parsed_at":"2024-08-05T17:21:37.246Z","dependency_job_id":null,"html_url":"https://github.com/orkan/wp-base","commit_stats":null,"previous_names":["orkan/wp-base"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkan%2Fwp-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkan%2Fwp-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkan%2Fwp-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkan%2Fwp-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orkan","download_url":"https://codeload.github.com/orkan/wp-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243475362,"owners_count":20296714,"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":["boilerplate","class","extend","framework","plugin","wordpress","wordpress-plugin"],"created_at":"2025-03-13T20:19:04.285Z","updated_at":"2025-03-13T20:19:05.017Z","avatar_url":"https://github.com/orkan.png","language":"PHP","readme":"# WordPress plugin boilerplate `v3.0.0`\nExtendable PHP classes for easy customization.\n\n## Out-of-the-box:\n- Dashboard: Settings and Tools pages (unlimited)\n- Custom DB cache\n- Ajax requests support\n- Custom admin Notices and Transients\n- CSS/JS assets: combine from partials, build, minify \u0026 enqueue\n\n## Introduction:\nThis package was made to provide a foundation to create your own WordPress plugin with a basic functionality already implemented, like the Settings page or DB cache supprort.\n\nThis package will install in Composer [vendor] dir, making it inaccessible from WordPress installation.\nYou must create your own folder in WP [plugins] dir and extend only those classes you will need in your project.\nA working example of such plugin can be found here: [Base1](https://github.com/orkan/wp-base1)\n\n## Create plugin:\nCreate your plugin entry point file `[WP]/wp-content/plugins/[your_plugin]/plugin.php`\nthen  `run()` only the necessary parts:\n```php\nnamespace My\\Name;\n/*\n * Plugin Name: My plugin\n */\n$Factory = new Factory();\n$Factory-\u003ePlugin()-\u003erun();\n$Factory-\u003eSettings()-\u003erun();\n```\n\n## Tools:\nThe [Base1](https://github.com/orkan/wp-base1) package comes with some example Tools and their CSS/JS assets (`/assets` dir) and FORM input definitions ( `/config` dir). The included Tools are:\n```php\n$Factory-\u003eMailer()-\u003erun(); // Example with WP Mail form\n$Factory-\u003eFormix()-\u003erun(); // Example how to create custom FORM with various inputs\n$Factory-\u003eAjaxer()-\u003erun(); // Example how to handle Ajax requests\n```\nLinks to these Tools will be automatically displayed in the: Dashboard \u003e Plugins \u003e My Plugin - meta row.\n\n## CSS/JS assets:\nThe example CSS/JS assets are pre-build and minified, but you can modify them and re-build on each page refresh by adding these constants to `wp-config.php` file:\n```php\ndefine( 'ORK_ASSET_REBUILD_CSS', true );\ndefine( 'ORK_ASSET_REBUILD_JS', true );\ndefine( 'ORK_ASSET_MINIFY_CSS', true );\ndefine( 'ORK_ASSET_MINIFY_JS', true );\n```\nAnother way to rebuild assets is by using a Composer script command: `composer run rebuildOrkWpBaseAssets` described in next section.\n\n## Composer:\nComposer is required to install this plugin and all its dependencies and also to support autoloading class files.\nThis README assumes following directory structure in your Composer/WordPress installation:\n```\n/htdocs\n  |- /html \u003c-- WordPress files\n  |- /vendor \u003c-- Composer files\n  |- composer.json \u003c-- root file\n```\nAdd composer autoloader to `wp-config.php` file:\n```php\nrequire __DIR__ . '/../vendor/autoload.php';\n```\nTurn your plugin into Composer package by adding these lines in your plugin's `composer.json` file:\n```json\n\"name\": \"my/wp-plugin\",\n\"type\": \"wordpress-plugin\",\n\"require\": {\n\t\"orkan/wp-base\": \"^3\"\n},\n\"autoload\": {\n\t\"psr-4\": {\n\t\t\"My\\\\Name\\\\\": \"src\"\n\t}\n},\n\"extra\": {\n\t\"installer-name\": \"my-plugin\"\n}\n```\nTo properly install WP plugins from Composer repositories add these lines  to your root `composer.json` file:\n```json\n\"extra\": {\n\t\"installer-paths\": {\n\t\t\"html/wp-content/plugins/{$name}\": [\n\t\t\t\"type:wordpress-plugin\"\n\t\t],\n\t\t\"html/wp-content/themes/{$name}\": [\n\t\t\t\"type:wordpress-theme\"\n\t\t]\n\t}\n}\n```\nIf you decide to build your assets automatically by using Composer scripts feature eg. on every \"dump autoload\", you can use the included method `Orkan\\\\WP\\\\Base\\\\Utils\\\\Composer::rebuildAssets`\n```json\n\"extra\": {\n\t\"ork-wp-base\": {\n\t\t\"wp-config\": \"html/wp-config.php\"\n\t}\n}\n\"scripts\": {\n\t\"rebuildMyPluginAssets\": [\n\t\t\"@putenv FACTORY=Orkan\\\\WP\\\\MyPlugin\\\\Factory\",\n\t\t\"Orkan\\\\WP\\\\Base\\\\Utils\\\\Composer::rebuildAssets\"\n\t],\n\t\"post-autoload-dump\": [\n\t\t\"@rebuildMyPluginAssets\"\n\t]\n}\n``` \nNow you can also manually rebuild assets by running this command: `composer run rebuildMyPluginAssets`\n\n## Requirements:\n- PHP ^7\n- Composer ^2\n- WordPress ^6\n\n## License:\n[MIT](https://github.com/orkan/wp-base/LICENCE)\n\n## Author\n[Orkan](https://github.com/orkan)\n\n## Updated\nSun, 26 May 2024 17:31:07 +02:00\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forkan%2Fwp-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forkan%2Fwp-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forkan%2Fwp-base/lists"}