PHP code example of magepal / magento2-ajax-newsletter-subscribe

1. Go to this page and download the library: Download magepal/magento2-ajax-newsletter-subscribe library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

magepal / magento2-ajax-newsletter-subscribe example snippets



$response = [
    'status' => 1,
    'msg' => __('The confirmation request has been sent.'),
];

$response = [
    'status' => 0,
    'msg' => __('There was a problem with the subscription: %1', $e->getMessage()),
];