Add user role to generated plugin

If you look at the documentation for add_menu_page(), you’ll see the third argument is:

The capability required for this menu to be displayed to the user.

In WordPress you don’t require specific roles for permissions, you require a capability, and roles are collections of capabilities. Your menu page requires manage_options, which is only held by administrators by default. If you want to also allow access to Editors, then edit_pages is a capability only held by Administrators and Editors.

add_menu_page(
    'Example', // page_title
    'Example', // menu_title
    'edit_pages', // capability
    'example', // menu_slug
    array( $this, 'example_create_admin_page' ), // function
    'dashicons-admin-generic', // icon_url
    2 // position
);

Now the admin menu item will appears for any user with a role that has the edit_pages capability, which by default is just Administrators and Editors.

You will run into another issue though. Your admin page contains settings fields created with the Settings API. By default, regardless of the capability used to add the admin menu item, manage_options is required to submit settings forms.

To get around this, you need to use the option_page_capability_{$option_page} filter. With this filter you can change the required capability to submit your settings page. You just need to replace {$option_page} with the value that you passed to settings_fields() (which is, very frustratingly, the option group, not the option page).

add_filter(
    'option_page_capability_example_option_group',
    function() {
        return 'edit_pages';
    }
);