# Fail2Notify Core

Shared business logic for the Fail2Notify free and Pro plugins. This package exposes:

- A reusable Plugin class that hooks into wp_mail_failed and admin test actions
- An Admin helper that renders the shared settings page and log table
- A lightweight Logger that stores payloads inside WordPress options with a configurable limit
- Slack notifier plus an extendable notifier filter so channel support can be added per-edition

## Development

`ash
composer install
`

## Usage inside a plugin

`php
use F2N\Core\Config;
use F2N\Core\Logger;
use F2N\Core\Plugin;
use F2N\Core\Admin;
use F2N\Core\Notifiers\Slack;

 = new Config([
    'slug'              => 'f2n',
    'option_key'        => 'f2n_settings',
    'log_option_key'    => 'f2n_logs',
    'settings_page_slug'=> 'f2n-settings',
    'text_domain'       => 'fail2notify',
    'log_limit'         => 20,
]);

 = new Logger();
 = new Plugin(, );
  = new Admin(, );

add_filter(->hook('notifiers'), function (, ) {
    if (! empty(['slack_webhook'])) {
        [] = new Slack(['slack_webhook']);
    }
    return ;
}, 10, 2);

add_action('plugins_loaded', static function () use (, ) {
    ->init();
    ->init();
});
`

See the free/Pro plugin folders for complete examples including build scripts.
