Giter Club home page Giter Club logo

mailerlite-php's People

Contributors

dinomh avatar gsteel avatar johnkelesidis avatar mlasek1991 avatar nklmilojevic avatar npetrunova avatar pushkidman avatar rekerta avatar shuvroroy avatar thenabeel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mailerlite-php's Issues

MailerLite PHP SDK Adding HTML Content

Summary

When creating a new campaign using the MailerLite PHP SDK, MailerLite is automatically adding code to the bottom of the HTML content even when the Unsubscribe tag is present in the 'content' parameter being passed to MailerLite API and the "Automatically generate a footer from the company details." is unchecked in the Account Settings. If you edit the HTML content in the MailerLite UX, the code disappears.

Expected Results

A campaign would be created containing only my HTML code that was in the 'content' parameter. In the below example, it is <p>Thanks for the email. <a href="{$unsubscribe}">Unsubscribe</a></p>.

Actual Results

The following code is inserted below the HTML code in the 'content' parameter.

<style type="text/css">
    .mlFooter p{margin:0}@media only screen and (max-width:640px){.mlContentTable{width:100%!important;min-width:10%!important;margin:0!important;float:none!important}.mlContentOuter{padding-bottom:0!important;padding-left:15px!important;padding-right:15px!important;padding-top:0!important}}
</style>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="680" style="width: 680px; min-width: 680px;" class="mlMainContent" dir="ltr">
    <tbody>
        <tr>
            <td class="mlTemplateContainer" style="padding: 20px 20px 0px 20px;">
                <table border="0" cellpadding="0" width="100%" class="mlMainContent" style="border-top: 1px solid #d1d3d3;">
                    <tbody>
                        <tr>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
<table role="article" aria-roledescription="email" align="center" border="0" cellpadding="0" cellspacing="0" width="680" style="width: 680px; min-width: 680px;" class="mlMainContent" dir="ltr">
    <tbody>
        <tr>
            <td class="mlTemplateContainer" style="padding: 20px 20px 0px 20px;">
                <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mlMainContent">
                    <tbody>
                        <tr>
                            <td style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 125%; color: #000000; padding-top: 15px;" class="ml-rte-footer" align="left">
                            </td>
                        </tr>
                        <tr>
                            <td id="mlRTEfooterUnsubscribe" style="line-height: 125%;" align="left">
                            </td>
                        </tr>
                        <tr>
                            <td height="20"></td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>

Steps to Reproduce

  1. Install MailerLite PHP SDK as shown here: https://github.com/mailerlite/mailerlite-php
  2. Create new php file in the project copying and pasting the example shown here: https://github.com/mailerlite/mailerlite-php#create-campaign
  3. Add any HTML into the 'content' parameter. I added: <p>Thanks for the email. <a href="{$unsubscribe}">Unsubscribe</a></p>
  4. From the command line, run your PHP file to create the campaign.
  5. The campaign should be created in your MailerLite account and, when you preview the created campaign, you should see the extra code inserted. Here's a preview of a campaign I created via the MailerLite PHP SDK: https://preview.mailerlite.io/preview/692096/emails/107481786535118262

For the above steps to reproduce, here's the entirety of my PHP file:

require 'vendor/autoload.php';

use MailerLite\MailerLite;

$mailerLite = new MailerLite(['api_key' => '{my API key went here}']);

$data = [
    'type' => 'regular',
    'name' => '{my campaign name went here}',
	'language_id' => 4,
    'emails' => [
        [
            'subject' => '{my subject went here}',
            'from_name' => '{my name went here}',
            'from' => '{my verified email address went here}',
            'content' => '<p>Thanks for the email. <a href="{$unsubscribe}">Unsubscribe</a></p>',
        ]
    ],
    'filter' => [],
];

$response = $mailerLite->campaigns->create($data);

Requires PHP8.1, not 7.4

  • Search for existing issues

Summary

When using this SDK, I get the following error:

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.22

Requiring 8.1 is not yet feasible in my attempts to use this in a WordPress plugin which only has PHP 7.4 as its minimum requirement.

Expected Results

I should be able to use this on PHP 7.4 and greater according to the documentation

Actual Results

You need PHP 8.1. The error does go away when I use at minimum 8.1.

Steps to Reproduce

Make any request and this is the result I get.

Get subscriber list does not include group information

According to the MailerLite documentation, a call to get all subscribers returns group information for each subscriber:

https://developers.mailerlite.com/docs/subscribers.html#list-all-subscribers

When I call the following:

$response = $mailerLite->subscribers->get();

it does not return group information for each subscriber. There is no groups array included in the response.

Do we need to include something in the call to ask the api to include group info?

$response = $mailerLite->subscribers->get(['someparm' => 'someval' ]); // ??

Thanks.

Need `forget` for subscribers

Is your proposal related to a problem?

The SDK for subscribers doesn't seem to support forget, although this exists in the REST API.

Describe the solution you'd like

$mailerLite->subscribers->forget($id)

Describe alternatives you've considered

I currently have to not use the SDK and instead make HTTP requests directly.

Undefined index api_key in HttpLayer (Undocumented requirements for overriding the HTTP client, Request Factory etc)

  • Search for existing issues

Summary

If you want to construct your own "HttpLayer" (i.e. to re-use existing HTTP Client etc), you need to explicitly pass in the options array including the API key. This is undocumented. In fact, the main client interface "MailerLite" checks the options array given to the constructor for the api key, and throws an exception if it's not present, and then never uses it internally, assuming that the HttpLayer will be constructed internally and not passed as a constructor argument. It would make more sense to check for the presence of the api key inside the 'HttpLayer' and throw an exception there.

Adding an array shape to the constructors of both would be helpful, for example:

/** @param array{api_key: non-empty-string} $options */
public function __construct(array $options, ...) {}

Expected Results

Not providing a valid API Key to HttpLayer::__construct() should throw an exception

Actual Results

PHP Notice: undefined index 'api_key'

Steps to Reproduce

Campaign create with plain_text Field throws wrong error

Summary

When i set the plain_text Field on the emails array on create campaign the API returns a error and it returns a wrong one.
It says «The emails.0 field must be an array» alltough everything is set as in the API docs.

Expected Results

Both examples should work fine or return a correct error.

Actual Results

The API returns following error: «The emails.0 field must be an array»

Steps to Reproduce

<?php

use MailerLite\MailerLite;

require_once "vendor/autoload.php";

$mailerLite = new MailerLite([
    "api_key" => "",
]);

// This request works as expected:
$response = $mailerLite->campaigns->create([
    "type" => "regular",
    "name" => "My new campaign",
    "language_id" => 10,
    "emails" => [
        [
            "subject" => "My new email",
            "from_name" => "My Customer",
            "from" => "[email protected]",
            "content" => "Hello World!",
        ],
    ],
    "filter" => [],
]);

// This request throws the error that emails.0 is not set, alltough the problem is with plain_text:
$response = $mailerLite->campaigns->create([
    "type" => "regular",
    "name" => "My new campaign",
    "language_id" => 10,
    "emails" => [
        [
            "subject" => "My new email",
            "from_name" => "My Customer",
            "from" => "[email protected]",
            "content" => "Hello World!",
            "plain_text" => "Hello World!",
        ],
    ],
    "filter" => [],
]);
// PHP Fatal error:  Uncaught MailerLite\Exceptions\MailerLiteValidationException: The emails.0 field must be an array

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.