{"id":23134738,"url":"https://github.com/sendamply/amply-php","last_synced_at":"2025-04-04T08:21:52.703Z","repository":{"id":56947345,"uuid":"325628017","full_name":"sendamply/amply-php","owner":"sendamply","description":"PHP SDK for Amply","archived":false,"fork":false,"pushed_at":"2020-12-31T00:16:03.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T19:26:24.926Z","etag":null,"topics":["amply","email","php","transactional-email"],"latest_commit_sha":null,"homepage":"https://sendamply.com","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/sendamply.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-30T19:07:12.000Z","updated_at":"2021-08-03T17:13:12.000Z","dependencies_parsed_at":"2022-08-21T07:51:00.560Z","dependency_job_id":null,"html_url":"https://github.com/sendamply/amply-php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendamply%2Famply-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendamply%2Famply-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendamply%2Famply-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendamply%2Famply-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sendamply","download_url":"https://codeload.github.com/sendamply/amply-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142527,"owners_count":20890740,"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":["amply","email","php","transactional-email"],"created_at":"2024-12-17T12:12:56.722Z","updated_at":"2025-04-04T08:21:52.639Z","avatar_url":"https://github.com/sendamply.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amply\n\nThis is the Amply PHP SDK that integrates with the [v1 API](https://docs.sendamply.com/docs/api/docs/Introduction.md).\n\n__Table of Contents__\n\n- [Install](#install)\n- [Quick Start](#quick-start)\n- [Methods](#methods)\n\t- [email](#email)\n\n## Install\n\n### Prerequisites\n- PHP 7.0+\n- Amply account, [sign up here.](https://sendamply.com/plans)\n\n### Access Token\n\nObtain your access token from the [Amply UI.](https://sendamply.com/home/settings/access_tokens)\n\n### Install Package\nAdd Amply to your composer.json file. If you are not using Composer, we highly recommend it. It's an excellent way to manage dependencies in your PHP application.\n```\n{\n  \"require\": {\n    \"amply/amply-php\": \"*\"\n  }\n}\n```\n\n## Alternative: Install from repo\nIf you are not using Composer, simply download and checkout the version you want to use from the Github repository.\n\n```\ngit clone https://github.com/sendamply/amply-php.git\ngit checkout VERSION\n```\n\n### Domain Verification\nAdd domains you want to send `from` via the [Verified Domains](https://sendamply.com/home/settings/verified_domains) tab on your dashboard.\n\nAny emails you attempt to send from an unverified domain will be rejected.  Once verified, Amply immediately starts warming up your domain and IP reputation.  This warmup process will take approximately one week before maximal deliverability has been reached.\n\n## Quick Start\nThe following is the minimum needed code to send a simple email. Use this example, and modify the `to` and `from` variables:\n\n```php\n// Uncomment the next line if you're using a dependency loader (such as Composer) (recommended)\n// require 'vendor/autoload.php';\n\n// Uncomment the next line if you're not using a dependency loader (such as Composer), replacing \u003cPATH TO\u003e with the path to the amply-php.php file\n// require_once '\u003cPATH TO\u003e/amply-php.php';\n\n$amply = new Amply(getenv('AMPLY_ACCESS_TOKEN'));\n\ntry {\n    $amply-\u003eemail-\u003ecreate(array(\n        'to' =\u003e 'test@example.com',\n        'from' =\u003e 'test@verifieddomain.com',\n        'subject' =\u003e 'My first Amply email!',\n        'text' =\u003e 'This is easy',\n        'html' =\u003e '\u003cstrong\u003eand fun :)\u003c/strong\u003e'\n    ));\n}\ncatch (\\Amply\\Exceptions\\APIException $e) {\n    echo \"Generic API error\\n\";\n    echo \"$e-\u003ecode\\n\";\n    echo \"$e-\u003etext\\n\";\n}\ncatch (\\Amply\\Exceptions\\ValidationException $e) {\n    echo \"Invalid input\\n\";\n    print_r($e-\u003eerrors);\n}\ncatch (\\Amply\\Exceptions\\ResourceNotFoundException $e) {\n    echo \"Missing resource\\n\";\n    print_r($e-\u003eerrors);\n}\n```\n\nOnce you execute this code, you should have an email in the inbox of the recipient.  You can check the status of your email in the UI from the [Search](https://sendamply.com/home/analytics/searches/basic/new), [SQL](https://sendamply.com/home/analytics/searches/sql/new), or [Users](https://sendamply.com/home/analytics/users) page.\n\n## Methods\n\n### email\n\nParameter(s)         | Description\n:---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nto, cc, bcc | Email address of the recipient(s).  This may be a string `\"Test \u003ctest@example.com\u003e\"`, an associative array `array('name' =\u003e 'Bill', 'email' =\u003e 'test@test.com')`, or a sequential array of strings/associative arrays.\npersonalizations | For fine tuned access, you may override the to, cc, and bcc keys and use advanced personalizations.  See the API guide [here](https://docs.sendamply.com/docs/api/Mail-Send.v1.yaml/paths/~1email/post).\nfrom | Email address of the sender.  This may be formatted as a string or associative array with name and email keys.  An array of senders is not allowed.\nsubject | Subject of the message.\nhtml | HTML portion of the message.\ntext | Text portion of the message.\ncontent | A sequential array of associative arrays containing the following fields: `type` (required), `value` (required).\ntemplate | The template to use. This may be a string (the UUID of the template), a sequential array of UUID strings (useful for A/B/... testing where one is randomly selected), or an associative array of the format `array('template1Uuid' =\u003e 0.25, 'template2Uuid' =\u003e 0.75)` (useful for weighted A/B/... testing).\ndynamicTemplateData | The dynamic data to be replaced in your template.  This is an associative array of the format `array('variable1' =\u003e 'replacement1', ...)`. Variables should be defined in your template body as `${variable1}`.\nreplyTo |Email address of who should receive replies.  This may be a string or an associative array with `name` (optional) and `email` fields.\nheaders | An associative array where the header name is the key and header value is the value.\nipOrPoolUuid | The UUID string of the IP address or IP pool you want to send from.  Default is your Global pool.\nunsubscribeGroupUuid | The UUID string of the unsubscribe group you want to associate with this email.\nattachments[] | An array of attachments containting an associative array with fields `content`, `filename`, `type`, `disposition`, and`contentId`.\nttachments[][content] | A base64 encoded string of your attachment's content (required, string).\nattachments[][type] | The MIME type of your attachment (optional, string).\nattachments[][filename] | The filename of your attachment (required, string).\nattachments[][disposition] | The disposition of your attachment (`inline` or `attachment`) (optional, string).\nattachments[][contentId] | The content ID of your attachment (optional, string).\nclicktracking | Enable or disable clicktracking (bool).\ncategories | A sequential array of email category strings you can associate with your message.\nsubstitutions | An associative array of the format `array('subFrom' =\u003e 'subTo', ...}` of substitutions.\n\n__Example__\n\n```php\n$amply.email.create(array(\n    'to' =\u003e \"example@test.com\",\n    'cc' =\u003e array('name' =\u003e 'Billy', 'email' =\u003e 'Smith'),\n    'from' =\u003e 'From \u003cexample@verifieddomain.com\u003e',\n    'text' =\u003e 'Text part',\n    'html' =\u003e 'HTML part',\n    'content' =\u003e array(\n        array(\n            'type' =\u003e 'text/testing',\n            'value' =\u003e 'Test!',\n        ),\n    ),\n    'subject' =\u003e 'A new email!',\n    'replyTo' =\u003e 'Reply To \u003ctest@example.com\u003e',\n    'template' =\u003e 'faecb75b-371e-4062-89d5-372b8ff0effd',\n    'dynamicTemplateData' =\u003e array('name' =\u003e 'Jimmy'),\n    'unsubscribeGroupUuid' =\u003e '5ac48b43-6e7e-4c51-817d-f81ea0a09816',\n    'ipOrPoolUuid' =\u003e '2e378fc9-3e23-4853-bccb-2990fda83ca9',\n    'attachments' =\u003e array(\n        array(\n            'content' =\u003e 'dGVzdA==',\n            'filename' =\u003e 'test.txt',\n        ),\n    ),\n    'headers' =\u003e array('X-Testing' =\u003e 'Test'),\n    'categories' =\u003e array('Test'),\n    'clicktracking' =\u003e true,\n    'substitutions' =\u003e array('sub1' =\u003e 'replacement1')\n));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendamply%2Famply-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsendamply%2Famply-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendamply%2Famply-php/lists"}