Skip to content

Commit

Permalink
Merge pull request #14 from wp-media/enhancement/13-update-documentation
Browse files Browse the repository at this point in the history
Updated documentation
  • Loading branch information
jeawhanlee authored Nov 28, 2024
2 parents 67e1323 + c152117 commit 2d33511
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2d33511

Please sign in to comment.