{"id":19326005,"url":"https://github.com/linkorb/herald-client-php","last_synced_at":"2025-04-22T20:32:14.294Z","repository":{"id":28547796,"uuid":"32065016","full_name":"linkorb/herald-client-php","owner":"linkorb","description":"Herald client for PHP - Library + CLI tools","archived":false,"fork":false,"pushed_at":"2023-05-05T12:22:04.000Z","size":67,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-11T13:37:17.178Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/linkorb.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":"2015-03-12T08:12:36.000Z","updated_at":"2022-10-06T11:04:35.000Z","dependencies_parsed_at":"2022-08-18T03:01:51.652Z","dependency_job_id":null,"html_url":"https://github.com/linkorb/herald-client-php","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Fherald-client-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Fherald-client-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Fherald-client-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Fherald-client-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkorb","download_url":"https://codeload.github.com/linkorb/herald-client-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903480,"owners_count":17222551,"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":[],"created_at":"2024-11-10T02:12:11.714Z","updated_at":"2024-11-10T02:12:12.516Z","avatar_url":"https://github.com/linkorb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Herald PHP client\n==============\n\nSend beautiful messages from your application.\n\n## Installation\n```\ncomposer require herald-project/client-php\n```\n\n## Example\n```php\nuse Herald\\Client\\Client as HeraldClient;\nuse Herald\\Client\\Message as HeraldMessage;\n\n// get the client with explicit parameters\n$herald = new HeraldClient(\n    '[herald api username]',\n    '[herald api password]',\n    '[herald server uri]',\n    '[herald transport, e.g. smtp]'),\n    '[herald account]',\n    '[herald library]',\n);\n\n// get the client by DSN\n\n$herald = HeraldClient::fromDsn('https://username:password@herald.dev/myAccount/myLibrary/myTransport');\n\n\n// check template existance.\nif ($herald-\u003etemplateExists('signup')) {\n    // get the message\n    $message = new HeraldMessage();\n    // use the template\n    $message-\u003esetTemplate('signup');\n    // set to address\n    $message-\u003esetToAddress($emailAddress, $customerName);\n    // populate data\n    $message-\u003esetData('firstname', 'Hongliang');\n    $message-\u003esetData('nickname', 'exploder hater');\n    // send\n    $herald-\u003esend($message);\n}\n```\n## CLI usage\n\nYou can use the `bin/herald-client` CLI application to run commands against your herald server.\n\nThe application needs a couple of configuration directives to work:\n\n* username + password: The account you use to connect. Either a user account, or an API key+secret pair\n* apiurl: the base url of herald, (i.e. https://herald.dev) with postfix `/api/v2`\n* account + library: This is the library identifier you use to create your templates, layouts and transports\n\nYou can pass this data in 3 ways:\n\n### Individual options:\n\nFor example:\n\n    ./bin/herald-client --username=x --password=y --apiurl=https://herald.dev/api/v2 --account=test --library=test template:exists welcome\n\n### A single DSN\n\nFor example:\n\n    ./bin/herald-client --dsn=https://x:y@herald.dev/test/test/mandrill\n\n### By environment variables\n\nYou can define the environment variable `HERALD_DSN` with a valid URL, this way you don't\nneed to pass any options to the CLI application\n\n### By .env\n\nThe Herald CLI application loads `.env` before running any commands, allowing you to create a `.env` file \nlike this:\n\n```ini\nHERALD_DSN=https://x:y@herald.dev/test/test/mandrill\n```\n\nThis way you also don't need to pass any options for each command\n\n### Example commands\n\n    # get list of all contact lists\n    bin/herald-client list:list\n\n    # get list of contacts in contact list #1\n    bin/herald-client list:contacts 1\n\n    # get list of segments for list #1\n    bin/herald-client list:segments 1\n\n    # get available list_fields for list #1\n    bin/herald-client list:fields 1\n\n    # delete contact #42\n    #bin/herald-client contact:delete 42\n\n    # get properties of contact #6\n    bin/herald-client contact:properties 6\n\n    # add new contact with address 'new.contact@example.com' to list #1\n    bin/herald-client contact:add 1 new.contact@example.com\n\n    # add new property to contact #36 for list field id #4\n    bin/herald-client property:add 36 4 \"some value\"\n\n    # send message based on template #7 to all contacts in list #1\n    bin/herald-client list:send 1 7\n\n    # send message based on template #1 to contacts in list #1 that meet the conditions for segment #6\n    bin/herald-client list:send 1 7 6\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkorb%2Fherald-client-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkorb%2Fherald-client-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkorb%2Fherald-client-php/lists"}