{"id":28508399,"url":"https://github.com/mediaburst/clockwork-php","last_synced_at":"2025-08-15T22:19:36.912Z","repository":{"id":3154099,"uuid":"4184211","full_name":"mediaburst/clockwork-php","owner":"mediaburst","description":"PHP wrapper for Clockwork SMS from Mediaburst.","archived":false,"fork":false,"pushed_at":"2017-11-30T10:59:54.000Z","size":52,"stargazers_count":46,"open_issues_count":1,"forks_count":41,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-08-04T22:07:54.627Z","etag":null,"topics":["clockwork","php","sms","sms-api","sms-messages"],"latest_commit_sha":null,"homepage":"http://www.clockworksms.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"honestbleeps/BetterZoom","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mediaburst.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-30T15:47:59.000Z","updated_at":"2025-06-23T15:16:27.000Z","dependencies_parsed_at":"2022-08-20T10:10:20.475Z","dependency_job_id":null,"html_url":"https://github.com/mediaburst/clockwork-php","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mediaburst/clockwork-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mediaburst","download_url":"https://codeload.github.com/mediaburst/clockwork-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediaburst%2Fclockwork-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270637776,"owners_count":24620428,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clockwork","php","sms","sms-api","sms-messages"],"created_at":"2025-06-08T21:08:55.097Z","updated_at":"2025-08-15T22:19:36.881Z","avatar_url":"https://github.com/mediaburst.png","language":"PHP","readme":"# Clockwork SMS API Wrapper for PHP\n\nThis wrapper lets you interact with Clockwork without the hassle of having to create any XML or make HTTP calls.\n\n## What's Clockwork?\n\n[Clockwork][2] is Mediaburst's SMS API.\n\n### Prerequisites\n\n* A [Clockwork][2] account\n\n## Usage\n\n### Installing with composer\nThe easiest way to get Clockwork is to use [Composer][4] to automatically download and include it in your project. Setup [Composer][4] and add us to your composer.json \n```php\n{\n    \"require\": {\n        \"mediaburst/clockworksms\": \"2.0.*\"\n    }\n}\n```\nIf you are using your own autoloader we are using the PSR-4 namespacing scheme.\n\n### Including directly\n\nDownload the Clockwork library, put it in your project and require the Clockwork class and the ClockworkException classes:\n\n```php\nrequire 'src/Clockwork.php';\nrequire 'src/ClockworkException.php';\n```\n\n### Sending a message\n\n```php\n$clockwork = new mediaburst\\ClockworkSMS\\Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.\n$message = array( 'to' =\u003e '441234567891', 'message' =\u003e 'This is a test!' );\n$result = $clockwork-\u003esend( $message );\n```\n\n### Sending multiple messages\n\nWe recommend you use batch sizes of 500 messages or fewer. By limiting the batch size it prevents any timeouts when sending.\n\n```php\n$clockwork = new mediaburst\\ClockworkSMS\\Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.\n$messages = array( \n    array( 'to' =\u003e '441234567891', 'message' =\u003e 'This is a test!' ),\n    array( 'to' =\u003e '441234567892', 'message' =\u003e 'This is a test 2!' )\n);\n$results = $clockwork-\u003esend( $messages );\n```\n\n### Handling the response\n\nThe responses come back as arrays, these contain the unique Clockwork message ID, whether the message worked (`success`), and the original SMS so you can update your database.\n\n    Array\n    (\n        [id] =\u003e VE_164732148\n        [success] =\u003e 1\n        [sms] =\u003e Array\n            (\n                [to] =\u003e 441234567891\n                [message] =\u003e This is a test!\n            )\n\n    )\n\nIf you send multiple SMS messages in a single send, you'll get back an array of results, one per SMS.\n\nThe result will look something like this:\n\n    Array\n    (\n        [0] =\u003e Array\n            (\n                [id] =\u003e VI_143228951\n                [success] =\u003e 1\n                [sms] =\u003e Array\n                    (\n                        [to] =\u003e 441234567891\n                        [message] =\u003e This is a test!\n                    )\n\n            )\n\n        [1] =\u003e Array\n            (\n                [id] =\u003e VI_143228952\n                [success] =\u003e 1\n                [sms] =\u003e Array\n                    (\n                        [to] =\u003e 441234567892\n                        [message] =\u003e This is a test 2!\n                    )\n\n            )\n\n    )\n\nIf a message fails, the reason for failure will be set in `error_code` and `error_message`.  \n\nFor example, if you send to invalid phone number \"abc\":\n\n    Array\n    (\n        [error_code] =\u003e 10\n        [error_message] =\u003e Invalid 'To' Parameter\n        [success] =\u003e 0\n        [sms] =\u003e Array\n            (\n                [to] =\u003e abc\n                [message] =\u003e This is a test!\n            )\n\n    )\n\n### Checking your balance\n\nCheck your available SMS balance:\n\n```php\n$clockwork = new mediaburst\\ClockworkSMS\\Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.\n$clockwork-\u003echeckBalance();\n```    \n\nThis will return:\n\n    Array \n    (\n        [symbol] =\u003e £\n        [balance] =\u003e 351.91\n        [code] =\u003e GBP\n        [account_type] =\u003e PAYG\n    )\n    \nAccount Type can be either PAYG or Invoice.\n\n### Handling Errors\n\nThe Clockwork wrapper will throw a `ClockworkException` if the entire call failed.\n\n```php\ntry \n{\n    $clockwork = new mediaburst\\ClockworkSMS\\Clockwork( 'invalid_key' );\n    $message = array( 'to' =\u003e 'abc', 'message' =\u003e 'This is a test!' );\n    $result = $clockwork-\u003esend( $message );\n}\ncatch( mediaburst\\ClockworkSMS\\ClockworkException $e )\n{\n    print $e-\u003egetMessage();\n    // Invalid API Key\n}\n```    \n\n### Advanced Usage\n\nThis class has a few additional features that some users may find useful, if these are not set your account defaults will be used.\n\n### Optional Parameters\n\nSee the [Clockwork Documentation](http://www.clockworksms.com/doc/clever-stuff/xml-interface/send-sms/) for full details on these options.\n\n*   $from [string]\n\n    The from address displayed on a phone when they receive a message\n\n*   $long [boolean]  \n\n    Enable long SMS. A standard text can contain 160 characters, a long SMS supports up to 459.\n\n*   $truncate [nullable boolean]  \n\n    Truncate the message payload if it is too long, if this is set to false, the message will fail if it is too long.\n\n*\t$invalid_char_action [string]\n\n\tWhat to do if the message contains an invalid character. Possible values are\n\t* error\t\t\t - Fail the message\n\t* remove\t\t - Remove the invalid characters then send\n\t* replace\t\t - Replace some common invalid characters such as replacing curved quotes with straight quotes\n\n*   $ssl [boolean, default: true]\n  \n    Use SSL when making an HTTP request to the Clockwork API\n\n\n### Setting Options\n\n#### Global Options\n\nOptions set on the API object will apply to all SMS messages unless specifically overridden.\n\nIn this example both messages will be sent from Clockwork:\n\n```php\n$options = array( 'from' =\u003e 'Clockwork' );\n$clockwork = new mediaburst\\ClockworkSMS\\Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.\n$messages = array( \n    array( 'to' =\u003e '441234567891', 'message' =\u003e 'This is a test!' ),\n    array( 'to' =\u003e '441234567892', 'message' =\u003e 'This is a test 2!' )\n);\n$results = $clockwork-\u003esend( $messages );\n```\n\n#### Per-message Options\n\nSet option values individually on each message.\n\nIn this example, one message will be from Clockwork and the other from 84433:\n\n```php\n$clockwork = new mediaburst\\ClockworkSMS\\Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.\n$messages = array( \n    array( 'to' =\u003e '441234567891', 'message' =\u003e 'This is a test!', 'from' =\u003e 'Clockwork' ),\n    array( 'to' =\u003e '441234567892', 'message' =\u003e 'This is a test 2!', 'from' =\u003e '84433' )\n);\n$results = $clockwork-\u003esend( $messages );\n```\n\n### SSL Errors\n\nDue to the huge variety of PHP setups out there a small proportion of users may get PHP errors when making API calls due to their SSL configuration.\n\nThe errors will generally look something like this:\n\n```\nFatal error: \nUncaught exception 'Exception' with message 'HTTP Error calling Clockwork API\nHTTP Status: 0\ncURL Erorr: SSL certificate problem, verify that the CA cert is OK. \nDetails: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed'\n```\n\nIf you're seeing this error there are two fixes available, the first is easy, simply disable SSL on Clockwork calls. Alternatively you can setup your PHP install with the correct root certificates.\n\n#### Disable SSL on Clockwork calls\n\n```php\n$options = array( 'ssl' =\u003e false );\n$clockwork = new mediaburst\\ClockworkSMS\\Clockwork( $API_KEY, $options );  //Be careful not to post your API Keys to public repositories.\n```\n\n#### Setup SSL root certificates on your server\n\nThis is much more complicated as it depends on your setup, however there are many guides available online. \nTry a search term like \"windows php curl root certificates\" or \"ubuntu update root certificates\".\n\n\n# License\n\nThis project is licensed under the MIT open-source license.\n\nA copy of this license can be found in license.txt.\n\n# Contributing\n\nIf you have any feedback on this wrapper drop us an email to [hello@clockworksms.com][1].\n\nThe project is hosted on GitHub at [https://github.com/mediaburst/clockwork-php][3].\nIf you would like to contribute a bug fix or improvement please fork the project \nand submit a pull request.\n\n[1]: mailto:hello@clockworksms.com\n[2]: http://www.clockworksms.com/\n[3]: https://github.com/mediaburst/clockwork-php\n[4]: https://getcomposer.org/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediaburst%2Fclockwork-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediaburst%2Fclockwork-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediaburst%2Fclockwork-php/lists"}