{"id":15292318,"url":"https://github.com/ibelar/atk-wordpress","last_synced_at":"2025-04-13T11:11:43.186Z","repository":{"id":53913374,"uuid":"98429955","full_name":"ibelar/atk-wordpress","owner":"ibelar","description":"Wordpress plugin development using Agile Toolkit Framework (atk). Wordpress site demo available on www.atkwp.com","archived":false,"fork":false,"pushed_at":"2021-03-11T12:42:04.000Z","size":4180,"stargazers_count":8,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"dev-master","last_synced_at":"2025-03-27T02:21:41.435Z","etag":null,"topics":["dashboard-widget","widget","wordpress","wordpress-development","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/ibelar.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}},"created_at":"2017-07-26T14:08:04.000Z","updated_at":"2021-10-31T19:48:04.000Z","dependencies_parsed_at":"2022-08-13T04:10:16.302Z","dependency_job_id":null,"html_url":"https://github.com/ibelar/atk-wordpress","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibelar%2Fatk-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibelar%2Fatk-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibelar%2Fatk-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibelar%2Fatk-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibelar","download_url":"https://codeload.github.com/ibelar/atk-wordpress/tar.gz/refs/heads/dev-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":["dashboard-widget","widget","wordpress","wordpress-development","wordpress-plugin"],"created_at":"2024-09-30T16:17:22.908Z","updated_at":"2025-04-13T11:11:43.165Z","avatar_url":"https://github.com/ibelar.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Read Me\n\n## What is it?\n\nAtk-wordpress help build plugins for Wordpress. With this package, plugins UI elements are created using the [Agile Toolkit Framework ](http://www.agiletoolkit.org) for php.\n\nThis package make it easy to implement each of Wordpress components like: \n\n - Admin panels and sub-panels;\n - Widgets;\n - Dashboard widgets;\n - Meta boxes;\n - Shortcode;\n\nThen each component UI element, like **Form, Lister, CRUD, Icon, Button, Table and more** are easily add to the component, thanks to the Agile Toolkit framework for php.\n\nCreating a Wordpress component is as simple as:\n\n - define it's parameter as required by Wordpress;\n - define the proper View class to use for the component,  \n - define the component view by adding UI elements using Agile Toolkit framework;\n\nThis package will take care of properly wiring the necessary Wordpress hook and action for the component to run.\n\nFurthermore, components define will work under ajax, whether in admin or front section of Wordpress, right out-of-the-box.\n\n## Require\n\nThis package require [composer](https://getcomposer.org/) in order to install all it's dependencies.\n\n## Getting started\n\n### Using the starter project\n\nAlthough you can start from scratch, the easiest way would be to start using the [atk-wordpress-starter](http://github.com/ibelar/atk-wordpress-starter).\n \n - download or clone the starter project inside you Wordpress installation plugins folder, \n - rename it to match your plugin name and namespace by replacing text mark as TODO,\n - update the composer.json file and run composer.\n  \n\nThe starter project comes with empty configuration files for each components, except one, an admin panel that display a simple message.\n\n_Note: if the starter project is use as is, it will create a new plugin name atk-wordpress-starter. Once activated, a new admin panel will be accessible via \"Hello Atkwp\" menu item in Wordpress admin section._ \n\n### From scratch\n\nMinimal files and folders structure are required for creating a pluging using this package. These files and folders should be located directly under the plugins folder being built.\n\n - composer.json;\n - plugin.php file;\n - src folders with a Plugin.php class;\n    - Plugin.php must extends AtkWp class and implement the atkwp\\interfaces\\PluginInterface.\n - configurations folder;\n    - where default and components configurations are located.\n - assets folder;\n   - where custom css, js or images files are located.    \n\n#### Composer.json\n\nThe composer configuration file must require this package and autoload should match the plugin namespace.\n\n      \"require\": {\n        \"ibelar/atk-wordpress\": \"^1.0\"\n      },\n      \"autoload\": {\n          \"psr-4\": {\n            \"atkstarter\\\\\" : \"src/\"\n          }\n      }\n\n### plugin.php file\n\nThis is the plugin entry point in Wordpress as any other Wordpress plugin is required to have. It should contains your plugin name and description.\nThe plugin.php file is also responsible of creating and instantiating the Plugin.php class. It will also call the Plugin::booth() method.\nThe booth() method will load all components define in configuration file and properly hook up their Wordpress actions.\n\nThis is how it will normally look:\n\n    \u003c?php\n    /*\n    Plugin Name: My Plugin name\n    Description: My plugin description.\n    Version: 1.0\n    */\n    \n    namespace my_plugin_namespace;\n    \n    use atkwp\\controllers\\ComponentController;\n    use atkwp\\helpers\\Pathfinder;\n    \n    require 'vendor/autoload.php';\n    \n    if (array_search(ABSPATH . 'wp-admin/includes/plugin.php', get_included_files()) === false) {\n        require_once ABSPATH . 'wp-admin/includes/plugin.php';\n    }\n    \n    $atk_plugin_name = \"myPluginName\";\n    $atk_plugin = __NAMESPACE__.\"\\\\Plugin\";\n    \n    $$atk_plugin_name = new  $atk_plugin($atk_plugin_name, new Pathfinder(plugin_dir_path(__FILE__)), new ComponentController());\n    \n    if (!is_null( $$atk_plugin_name)) {\n        $$atk_plugin_name-\u003eboot(__FILE__);\n    }\n\n### Plugin.php class\n\nThe main plugin file. The Plugin class must extends the AtkWp class and implement the PluginInterface.\n\nMinimally, it should look like this:\n\n    \u003c?php\n    /**\n     * The Plugin implementation.\n     */\n    \n    namespace my_plugin_namespace;\n    \n    use atkwp\\interfaces\\PluginInterface;\n    use atkwp\\AtkWp;\n    \n    class Plugin extends AtkWp implements PluginInterface\n    {\n        public function init()\n        {\n            // Uncommented this for database connectivity.\n            //$this-\u003esetDbConnection();\n        }\n    \n        public function activatePlugin()\n        {\n            // TODO: Implement activatePlugin() method.\n        }\n    \n        public function deactivatePlugin()\n        {\n            // TODO: Implement deactivatePlugin() method.\n        }\n    }\n    \n### configuratons folder\n\nThis is the place where configuration files should be located. There is one configuration file for each possible component in Wordpress and one for default configuration value a plugin might needed.\n\nGenerally speaking, a component configuration required the uses of a php class implementing the component detail. The component class must extends the proper component's type class, for example a panel \ncomponent class would extends the PanelComponent type class. Each component's type class, except for WidgetComponent, is an Agile Toolkit View, that will automatically output itself when need by Wordpress. \nTherefore, you can use a component class as you would use a regular Agile Toolkit View class. (atk4\\ui)\n\n - [config-default.php](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-default.php) \n   - The default configuration a plugin might need. Developper can define their own configuration value and use them troughout their plugin.\n - [config-panel.php](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-panel.php)\n   - The configuration need to create admin section panel in Wordpress. You will define as many panels or sub-panels needed for your plugin.\n - [config-metabox.php](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-metabox.php)\n   - The configuration need to create meta box section in a Wordpress post. \n - [config-widget.php](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-widget.php)\n   - The configuration need to create widget in Wordpress.\n - [config-dashboard.php](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-dashboard.php)\n   - The configuration need to create dashboard widget in Wordpress.\n - [config-shortcode.php](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-shortcode.php)\n   - The configuration need to create shortcode in Wordpress.\n - [config-enqueue](https://github.com/ibelar/atk-wordpress-starter/blob/dev-master/configurations/config-enqueue.php)\n   - The configuration need to load custom js or css file within Wordpress.  \n\n_Note on WidgetComponent: The WidgetComponent type class is the only one not deriving from a regular atk4\\ui\\View class. The reason is that a Widget class in Wordpress must extends \\Wp_Widget.\nHowever, when running \\Wp_Widget::widget() or \\Wp_Widget::form() method, an atk4\\ui/View object is passed as an argument in order to be able to add atk UI element to the widget._\n\n### assets folder\n\nThe assest's a plugin need. It usually contains:\n\n - a js folder;\n - a css folder;\n - an images folder;\n\n## Sample plugin\n\nBeside the [plugin starter project](http://github.com/ibelar/atk-wordress-starter), there is a more complete plugin sample ([atk-wordpress-sample](http://github.com/ibelar/atk-wordress-sample)) available that use most of Wordpress components.\n\n# License\n\nCopyright (c) 2017 Alain Belair. MIT Licensed,\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, \nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n# Agile Toolkit\n\nTo know more about the [Agile Toolkit Framework ](http://www.agiletoolkit.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibelar%2Fatk-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibelar%2Fatk-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibelar%2Fatk-wordpress/lists"}