{"id":19235606,"url":"https://github.com/mediumart/orange-sms","last_synced_at":"2025-08-25T18:47:50.448Z","repository":{"id":19076704,"uuid":"86035675","full_name":"mediumart/orange-sms","owner":"mediumart","description":"A php library to interact with the orange sms api for MiddleEast and Africa.","archived":false,"fork":false,"pushed_at":"2021-12-26T14:09:26.000Z","size":74,"stargazers_count":13,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-21T12:44:39.469Z","etag":null,"topics":["orange","orange-api","php","sms"],"latest_commit_sha":null,"homepage":"","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/mediumart.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2017-03-24T06:40:17.000Z","updated_at":"2022-11-19T08:41:47.000Z","dependencies_parsed_at":"2022-07-28T23:18:57.659Z","dependency_job_id":null,"html_url":"https://github.com/mediumart/orange-sms","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Forange-sms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Forange-sms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Forange-sms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Forange-sms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mediumart","download_url":"https://codeload.github.com/mediumart/orange-sms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250002272,"owners_count":21359083,"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":["orange","orange-api","php","sms"],"created_at":"2024-11-09T16:17:31.768Z","updated_at":"2025-04-21T05:32:08.257Z","avatar_url":"https://github.com/mediumart.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# orange-sms\n\n[![Build Status](https://travis-ci.org/mediumart/orange-sms.svg?branch=master)](https://travis-ci.org/mediumart/orange-sms)\n[![Code Coverage](https://scrutinizer-ci.com/g/mediumart/orange-sms/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/mediumart/orange-sms/?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mediumart/orange-sms/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mediumart/orange-sms/?branch=master)\n\n## Description\nA php library to interact with the orange sms api for MiddleEast and Africa.\n\n## Installation\n\nUsing composer:\n```\n$ composer require mediumart/orange-sms\n```\n\n## Usage\nFirst you need to resolve a `SMSClient` instance:\n\n```php\nuse Mediumart\\Orange\\SMS\\SMS;\nuse Mediumart\\Orange\\SMS\\Http\\SMSClient;\n\n/**\n* if you already have a valid access token\n* */\n$client = SMSClient::getInstance('\u003cyour_access_token\u003e');\n\n// OR\n\n/**\n* directly using \u003cclient_id\u003e and \u003cclient_secret\u003e\n* */\n$client = SMSClient::getInstance('\u003cclient_id\u003e', '\u003cclient_secret\u003e');\n```\n\nnext step, create an `SMS` object passing it the `$client` :\n```php\n$sms = new SMS($client);\n```\nand you're good to go:\n```php\n// prepare and send an sms in a fluent way\n$sms-\u003emessage('Hello, my dear...')\n    -\u003efrom('+237690000000')\n    -\u003eto('+237670000000')\n    -\u003esend();\n```\n\nYou now have access to the full orange sms api through the `$sms` object  :\n```php\n// sending SMS.\n$response = $sms-\u003eto('+237670000000')\n                -\u003efrom('+237690000000', \u003c'optional_sender_name\u003e')\n                -\u003emessage('Hello, world!')\n                -\u003esend();\n\n// checking your balance(remaining sms units)\n// with optional country code filter ie: CIV\n$response = $sms-\u003ebalance('\u003ccountry_code\u003e');\n\n// checking SMS orders history\n// with optional country code filter ie: CMR\n$response = $sms-\u003eordersHistory('\u003ccountry_code\u003e');\n\n// checking SMS statistics\n// with optional country code filter\n// and optional appID filter\n$response = $sms-\u003estatistics('\u003ccountry_code\u003e', '\u003capp_id\u003e');\n\n// setting the SMS DR notification endpoint\n// '\u003cyour_backend_notification_url\u003e' $url\n// '\u003csender address\u003e' $sender = '+237690000000'\n$response = $sms-\u003esetDeliveryReceiptNotificationUrl($url, $sender);\n\n// checking the SMS DR notification endpoint\n// '\u003cyour_last_registered_endpoint_ID\u003e' $id\n$response = $sms-\u003echeckDeliveryReceiptNotificationUrl($id);\n\n// delete the SMS DR notification endpoint\n// '\u003clast_registered_endpoint_ID\u003e' $id\n// '\u003csender address\u003e' $sender = '+237690000000'\n$response = $sms-\u003edeleteDeliveryReceiptNotificationUrl($id, $sender);\n\n```\n\nAll `json` responses will automatically be converted to `array`.\n\nBe sure to lookup [the official documentation](https://developer.orange.com/apis/sms-cm/getting-started), to see what to expect as a `response` to each call.\n\n## Access Token\n\nWhen you resolve the `SMSClient` instance using your `client_id` and `client_secret`, a new access token will be fetched from the api server and automatically set on the instance, along with its lifetime in seconds.\n\nWe recommend saving the token (*maybe to your database*) for future use, at least within  the limit of its validity period. this will help speed up requests to the api.\n\nUse the `getToken()` and `getTokenExpiresIn()` to get those values from the instance:\n```php\nuse Mediumart\\Orange\\SMS\\Http\\SMSClient;\n\n$client = SMSClient::getInstance('\u003cclient_id\u003e', '\u003cclient_secret\u003e');\n\n// get the token\n$token = $client-\u003egetToken();\n\n// get the token lifetime in seconds\n$tokenExpiresIn = $client-\u003egetTokenExpiresIn();\n```\nIf you wish, you can also fetch your access token directly without resolving a client instance, using the static `authorize` method:\n```php\n$response = SMSClient::authorize('\u003cclient_id\u003e', '\u003cclient_secret\u003e');\n```\nthis will return as `$response`, an array of this form:\n```php\n[\n \"token_type\" =\u003e \"Bearer\",\n \"access_token\" =\u003e \"i6m2iIcY0SodWSe...L3ojAXXrH\",\n \"expires_in\" =\u003e \"7776000\"\n]\n```\n\n## SSL Certificate check issue\n\nIf you experience ssl certificate checking issue, in your local environment. You can disable the check temporarily with the following line, before starting to interact with the api in your code.\n\nJust for testing purposes though. You should never do this on a production server.\n```php\n\\Mediumart\\Orange\\SMS\\Http\\SMSClientRequest::verify(false);\n```\n\n## License\n\nMediumart orange-sms is an open-sourced software licensed under the [MIT license](https://github.com/mediumart/orange-sms/blob/master/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediumart%2Forange-sms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediumart%2Forange-sms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediumart%2Forange-sms/lists"}