From c1521176ab7f796bf165fa0e392304fcc8609446 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Thu, 28 Nov 2024 12:01:39 +0100 Subject: [PATCH] Updated documentation --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0fa3e28..f205252 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,38 @@ For Imagify, the link generated by the Imagify Partner package is used. PS: The Imagify Partner package needs be installed along side. refer [here](https://github.com/wp-media/wp-imagify-partner/) for more information. + +## Installations & Configurations + +### Mozart +It is strongly advised that this package is loaded using [Mozart](https://github.com/coenjacobs/mozart). This is to avoid package conflicts where the same package is being used in another plugin and loaded from the same namespace. So please, take the pain to install mozart as a development dependency of your plugin: +`composer require coenjacobs/mozart --dev` + +- After installation, now you are set to configure mozart: see [here](https://github.com/coenjacobs/mozart?tab=readme-ov-file#configuration) or simply refer to how it's done on wp-rocket [here](https://github.com/wp-media/wp-rocket/blob/df52190a44f6b07cd23dd1fa9f6790df0558ef4c/composer.json#L113), there's no shame. +- Lastly setup (post install & update) scripts as done [here](https://github.com/coenjacobs/mozart?tab=readme-ov-file#scripts) + +### Package + +Now for the package, we need to come back to composer.json file again. +- Remember the `extra` key we added while setting up mozart some minutes ago, Bingo! Add a new property in it like this: `"plugin_domain": "your_text_domain"`. Replace `your_text_domain` with your actual text domain. e.g for WP Rocket, it's `rocket` +- Now again, remember the (post install & update) script we also created, we'll add new properties there also like this: + + ```json + "post-install-cmd": [ + "Mozart\\dep_namespace\\WPMedia\\PluginFamily\\PostInstall::apply_text_domain" + ], + "post-update-cmd": [ + "Mozart\\dep_namespace\\WPMedia\\PluginFamily\\PostInstall::apply_text_domain" + ], + ``` + Replace `Mozart\\dep_namespace` with the `dep_namespace` you configured for mozart earlier. + + PS: The example above doesn't not take into consideration the mozart scripts. so don't copy directly and overwrite your scripts. + +- Finally, install using composer: `composer require wp-media/plugin-family` + ## Usage Instructions -- Install using composer: `composer require wp-media/plugin-family` - Import the model that holds the filtered data into your view class. ```php @@ -70,7 +99,7 @@ class Subscriber implements SubscriberInterface, PluginFamilyInterface { ``` The methods ( `install_activate` & `display_error_notice` ) are required. -PS: This example is based on the assumption that your plugin utilizes EDA. If EDA is not available, you can iterate through the events returned by `PluginFamily::get_subscribed_events()` and use `add_action` accordingly. +PS: This example is based on the assumption that your plugin utilizes EDA. If EDA is not implemented, you can iterate through the events returned by `PluginFamily::get_subscribed_events()` and use `add_action` accordingly. ## Development & Testing