Repository navigation
ENGL-663: Catch up the PHP SDK with the public API - #44
kavanpancholi merged 6 commits into
Conversation
[Medium risk] The review's account read no source beyond the diff and ran only grep, yet it asserts that HttpLayerPsrBridge::delete ignores the body, which is the reason deleteStep() sends branch_to_delete in the query string; that transport behaviour is unverified. Otherwise the change is additive: about 40 public methods plus one optional parameter on Segment::getSubscribers, and a revert undoes it, so the risk is medium. SummaryAdds missing automation, import, activity-log and segment-paging endpoints to the PHP SDK The change adds about 40 What's good
Review context · 1/5 commands
Reviews (1) · Last reviewed commit: "Document the new endpoints in the README" · claude-sonnet-5-5 |
Why?
The PHP SDK was behind the public API. It could read automations but not build, change or control them, and segment subscribers could not page. This catches it up with every subscribers, groups, segments, fields and automations endpoint on ENGL-663.
Changes
Segment::getSubscribers()now takes an optional$paramsarray, socursor,limitandfilter[status]can be sent. One-argument calls still work. This was the known bug on the card.Subscriber:getActivityLog()andfindImport().Group:importSubscribers()(POST /groups/{group}/import-subscribers).Automation: 40 new methods for automation CRUD, copy, enable, disable, test, add-subscribers, readd, the three activity actions, triggers, steps (including reorder, copy and A/B winner), email content, email stats, templates and the run count, A/B and subscriber reports.deleteStep()sendsbranch_to_deleteas a query param, because the PSR transport drops DELETE bodies.AutomationTest::test_request, plusSubscriberTest::test_get_activity_log,test_find_import,GroupTest::test_import_subscribersandSegmentTest::test_get_segment_subscribers_with_params. Each asserts the HTTP method, path, query and JSON body against the OpenAPI document. A newtests/Support/AssertsRequeststrait holds that assertion, andEcommerceTestnow uses it with the same behaviour as before.No existing method signature changed and nothing was removed.
src/MailerLite.phpis untouched, since no new endpoint class was needed.Endpoint checklist
"Live call" means the method was called once against a local API on a test account, and the effect was read back with a separate request: the rename stored, the subscriber in the group, the test email delivered, page 2 different from page 1, and so on.
Subscribers
POST /subscriberssubscribers->create()GET /subscribers/{subscriber}subscribers->find()PUT /subscribers/{subscriber}subscribers->update()GET /subscribers/{subscriber}/activity-logsubscribers->getActivityLog()GET /subscriberssubscribers->get()GET /subscribers/import/{import}subscribers->findImport()POST /subscribers/{subscriber}/forgetsubscribers->forget()DELETE /subscribers/{subscriber}subscribers->delete()Groups
POST /groupsgroups->create()GET /groupsgroups->get()PUT /groups/{group}groups->update()POST /subscribers/{subscriber}/groups/{group}groups->assignSubscriber()POST /groups/{group}/import-subscribersgroups->importSubscribers()GET /groups/{group}/subscribersgroups->getSubscribers()DELETE /subscribers/{subscriber}/groups/{group}groups->unAssignSubscriber()DELETE /groups/{group}groups->delete()Segments
GET /segmentssegments->get()PUT /segments/{segment}segments->update()GET /segments/{segment}/subscriberssegments->getSubscribers()DELETE /segments/{segment}segments->delete()Fields
POST /fieldsfields->create()GET /fieldsfields->get()PUT /fields/{field}fields->update()DELETE /fields/{field}fields->delete()Automations
POST /automationsautomations->create()PUT /automations/{automation}automations->update()POST /automations/{automation}/testautomations->test()POST /automations/{automation}/enableautomations->enable()POST /automations/{automation}/add-subscribersautomations->addSubscribers()GET /automations/{automation}/activityautomations->activity()POST /automations/{automation}/activity/add-to-groupautomations->addActivityToGroup()POST /automations/{automation}/activity/skip-delayautomations->skipActivityDelay()POST /automations/{automation}/activity/cancel-automationautomations->cancelActivity()POST /automations/{automation}/readdautomations->readd()POST /automations/{automation}/copyautomations->copy()POST /automations/{automation}/disableautomations->disable()DELETE /automations/{automation}automations->delete()Automation triggers
POST /automations/{automation}/triggersautomations->createTrigger()GET /automations/{automation}/triggersautomations->getTriggers()GET /automations/{automation}/triggers/{trigger}automations->findTrigger()PUT /automations/{automation}/triggers/{trigger}automations->updateTrigger()DELETE /automations/{automation}/triggers/{trigger}automations->deleteTrigger()Automation steps
POST /automations/{automation}/stepsautomations->createStep()GET /automations/{automation}/steps/indexautomations->getSteps()GET /automations/{automation}/steps/{step}automations->findStep()PUT /automations/{automation}/steps/{step}automations->updateStep()POST /automations/{automation}/steps/{step}/copyautomations->copyStep()POST /automations/{automation}/steps/reorderautomations->reorderSteps()DELETE /automations/{automation}/steps/{step}automations->deleteStep()PUT /automations/{automation}/steps/{step}/select-ab-test-winnerautomations->selectAbTestWinner()DELETE /automations/{automation}/steps/{step} with branch_to_deleteautomations->deleteStep()Automation emails
PUT /automations/{automation}/emails/{email}/contentautomations->updateEmailContent()GET /automations/{automation}/emails/{email}/contentautomations->getEmailContent()GET /automations/{automation}/emails/{email}/report-statsautomations->getEmailReportStats()GET /automations/{automation}/emails/{email}/unsubscribe-reasonsautomations->getEmailUnsubscribeReasons()Automation templates
GET /automation-templatesautomations->getTemplates()POST /automations/select-template/{automationTemplate}automations->selectTemplate()Automation reports
GET /automations/{automation}/steps/run-countsautomations->getStepRunCounts()GET /automations/{automation}/steps/run-counts/{step}automations->getStepRunCount()GET /automations/{automation}/triggers/run-countsautomations->getTriggerRunCounts()GET /automations/{automation}/triggers/run-counts/{trigger}automations->getTriggerRunCount()GET /automations/{automation}/ab-steps-statsautomations->getAbStepsStats()GET /automations/{automation}/activity/steps/{step}/subscribersautomations->getStepSubscribers()GET /automations/{automation}/activity/triggers/{trigger}/subscribersautomations->getTriggerSubscribers()GET /automations/{automation}/monthly-totals/emailautomations->getEmailStats()GET /automations/{automation}/monthly-totals/ecommerceautomations->getEcommerceStats()GET /automations/{automation}/order-activityautomations->getEcommerceOrders()GET /automations/{automation}/emails/{email}/ecommerce-overview-statsautomations->getEmailEcommerceStats()GET /automations/{automation}/ab-steps-stats/{step}automations->getAbStepStats()Risks
Low risk. The change is additive: new methods, and one new optional parameter. The one behaviour change is that
Segment::getSubscribers()now forwards query params. A caller who passed nothing before sends the same request as before.Anyone who extends these endpoint classes and already declares a method with one of the new names (for example
Automation::copy()ortest()) gets a signature clash on upgrade. This is worth a note in the release.Performance impact
None. Each method builds one URI and makes one request.
Security impact
No security impact. No auth or transport change.
How to QA
No QA needed on the app. This is a library change, and nothing in the MailerLite app changes. Reviewers can run
composer test.Verified before review: 69 of 69 live calls passed. What a local run cannot show:
add-subscribersruns are not trigger runs.How to release
Standard release. The repo keeps no hand-written CHANGELOG, so there is no entry.
Rollback strategy
Primary rollback method: revert
Code changes
Database migrations
Data modifications
External dependencies
Configuration changes:
Screenshots, recordings
N/A, library change.
I used AI to generate parts of this PR
Yes
Docs
The PR adheres to Pull Request guidelines.
See mandatory MailerLite PR rules and flow for more information.