{"id":18818038,"url":"https://github.com/mailerlite/mailerlite-api-v2-php-sdk","last_synced_at":"2025-05-15T18:09:53.437Z","repository":{"id":8528401,"uuid":"58554107","full_name":"mailerlite/mailerlite-api-v2-php-sdk","owner":"mailerlite","description":"Official PHP wrapper for MailerLite Classic HTTP API v2","archived":false,"fork":false,"pushed_at":"2025-02-03T15:10:29.000Z","size":78,"stargazers_count":79,"open_issues_count":9,"forks_count":43,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-31T22:18:28.092Z","etag":null,"topics":["email","email-campaigns","email-marketing","mailerlite","mailerlite-api","marketing-automation","marketing-emails","php","php-sdk"],"latest_commit_sha":null,"homepage":"https://developers-classic.mailerlite.com/docs","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mailerlite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-11T14:52:40.000Z","updated_at":"2025-02-17T10:27:58.000Z","dependencies_parsed_at":"2024-11-15T01:14:29.746Z","dependency_job_id":null,"html_url":"https://github.com/mailerlite/mailerlite-api-v2-php-sdk","commit_stats":{"total_commits":84,"total_committers":15,"mean_commits":5.6,"dds":0.5952380952380952,"last_synced_commit":"8161818ca65d22455e44f98aa692272cee54cda9"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailerlite%2Fmailerlite-api-v2-php-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailerlite%2Fmailerlite-api-v2-php-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailerlite%2Fmailerlite-api-v2-php-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailerlite%2Fmailerlite-api-v2-php-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailerlite","download_url":"https://codeload.github.com/mailerlite/mailerlite-api-v2-php-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744332,"owners_count":20988783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","email-campaigns","email-marketing","mailerlite","mailerlite-api","marketing-automation","marketing-emails","php","php-sdk"],"created_at":"2024-11-08T00:14:38.482Z","updated_at":"2025-04-07T23:08:01.734Z","avatar_url":"https://github.com/mailerlite.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MailerLite Classic API v2 PHP SDK\n\n**This library is for MailerLite Classic. If you want to integrate with MailerLite please use https://github.com/mailerlite/mailerlite-php instead.**\n\nIt is an official PHP SDK for the MailerLite Classic API.\n\nYou can find more examples and information about the MailerLite Classic API here: [https://developers-classic.mailerlite.com/docs](https://developers-classic.mailerlite.com/docs)\n\n## Getting started\n\nIn order to use this library you need to have at least PHP 7.1 version.\n\nThere are two ways to use MailerLite PHP SDK:\n\n##### Use [Composer](https://getcomposer.org/)\n\nIf you are not familiar with Composer, learn about it [here](https://getcomposer.org/doc/01-basic-usage.md).\n\nThen you will need to run this simple command using CLI:\n\n```\ncomposer require mailerlite/mailerlite-api-v2-php-sdk\n```\n\nThis library is built atop of [PSR-7](https://www.php-fig.org/psr/psr-7/) and\n[PSR-18](https://www.php-fig.org/psr/psr-18/). If you are receiving `Http\\Discovery\\Exception\\DiscoveryFailedException` exception, you will need to run:\n\n```bash\ncomposer require php-http/guzzle6-adapter\n```\n\n##### Manual (preferable for shared hostings)\n\nThis way is preferable only if you are using shared hosting and do not have a possibility to use Composer. You will need to download the source of the latest release from [here](https://github.com/mailerlite/mailerlite-api-v2-php-sdk/releases), extract it and place its contents in the root folder of your project. The next step is the same as using Composer, you will need to require `vendor/autoload.php` file in your index.php and lets dive in!\n\n## Usage examples\n\n#### Groups API\n\nIn the given example you will see how to initiate selected API and a few actions which are available:\n\n- Create group\n- Get groups\n- Update group\n- Get subscribers who belongs to selected group\n\n```php\n$groupsApi = (new \\MailerLiteApi\\MailerLite('your-api-key'))-\u003egroups();\n\n$newGroup = $groupsApi-\u003ecreate(['name' =\u003e 'New group']); // creates group and returns it\n\n$allGroups = $groupsApi-\u003eget(); // returns array of groups\n\n$groupId = 123;\n$singleGroup = $groupsApi-\u003efind($groupId); // returns single item object\n\n$subscribers = $groupsApi-\u003egetSubscribers($groupId); // get subscribers who belongs to selected group\n\n$subscribers = $groupsApi-\u003egetSubscribers($groupId, 'unsubscribed'); // get unsubscribed subscribers who belongs to selected group\n```\n\n#### Use multiple APIs at once\n\nAlso `MailerLiteApi\\MailerLite' object can be initiated before selecting API you want to use and it allows to achieve more.\n\n```php\n$mailerliteClient = new \\MailerLiteApi\\MailerLite('your-api-key');\n\n$groupsApi = $mailerliteClient-\u003egroups();\n$groups = $groupsApi-\u003eget(); // returns array of groups\n\n$fieldsApi = $mailerliteClient-\u003efields();\n$fields = $fieldsApi-\u003eget(); // returns array of fields\n```\n\n## Use your preferred HTTP client\n\nMailerLite SDK uses cURL as default HTTP client but it is easy to use your preferred client. It is achieved by using [HTTPlug](https://httplug.io) which is PSR-7 compliant HTTP client abstraction.\n\nHere is an example how to use [Guzzle](https://docs.guzzlephp.org/) instead of cURL:\n\n```php\n$guzzle = new \\GuzzleHttp\\Client();\n$guzzleClient = new \\Http\\Adapter\\Guzzle6\\Client($guzzle);\n\n$mailerliteClient = new \\MailerLiteApi\\MailerLite('your-api-key', $guzzleClient);\n```\n\n## Support and Feedback\n\nIn case you find any bugs, submit an issue directly here in GitHub.\n\nYou are welcome to create SDK for any other programming language.\n\nIf you have any troubles using our API or SDK free to contact our support by email [info@mailerlite.com](mailto:info@mailerlite)\n\nOfficial documentation is at [https://developers-classic.mailerlite.com/docs](https://developers-classic.mailerlite.com/docs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailerlite%2Fmailerlite-api-v2-php-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailerlite%2Fmailerlite-api-v2-php-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailerlite%2Fmailerlite-api-v2-php-sdk/lists"}