{"id":3648,"date":"2019-11-08T09:44:33","date_gmt":"2019-11-08T09:44:33","guid":{"rendered":"https:\/\/infyblog.zluck.in\/?p=3648"},"modified":"2024-08-14T11:24:56","modified_gmt":"2024-08-14T11:24:56","slug":"sms-driver-with-laravel-facades-and-service-providers","status":"publish","type":"post","link":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/","title":{"rendered":"SMS Driver with Laravel Facades and Service Providers"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3648\" class=\"elementor elementor-3648\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1d71080 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1d71080\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6fd04aa\" data-id=\"6fd04aa\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\n\t\t<div class=\"elementor-element elementor-element-816c6ab elementor-widget elementor-widget-text-editor\" data-id=\"816c6ab\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>In the previous article, we learned <a href=\"https:\/\/blog.infyom.com\/how-to-create-laravel-facade\">How to create Laravel Facade<\/a> and how it can help to simplify our code and make it more accessible and beautiful.<\/p><p>In this article, we will see how we can control our SMS Provider\/Gateway via configuration without even touching the code and changing it from the environment directly.<\/p><h2>Use Case<\/h2><p>Imagine you have two SMS Providers called <strong>ABC<\/strong> and <strong>XYZ<\/strong> that you are using in our application. But you need to switch it over time. But the trick is, you do not want to change your code when you change to another SMS service provider. Just like when you change any driver in a Laravel App like Log, Cache, Queue, Database, etc.<\/p><p>So let&#8217;s figure out how to do that.<\/p><h2>Solution<br \/>Create SMS Service Contract<\/h2><p>Create an SMS Service contract interface that contains the method to send the SMS.<\/p><p>Create a class <span style=\"color: #e83e8c;\">app\/Services\/Contracts\/SMSServiceContract.php<\/span> with the following content,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62a1559 elementor-widget elementor-widget-code-highlight\" data-id=\"62a1559\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><?php\nnamespace App\\Services\\Contracts;\n\ninterface SMSServiceContract\n{\n    public function sendSMS($phone, $message);\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aa4794d elementor-widget elementor-widget-text-editor\" data-id=\"aa4794d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The purpose of this class is, every SMS Service should implement this interface and it should have at least one method <span style=\"color: #e83e8c;\">sendSMS<\/span> with the same parameters.<\/p><h2>Create SMS Service Implementations<\/h2><p>The second step is to create the real implementation of our SMS Services which will be responsible for sending the SMS.<\/p><p>So as we have two SMS services, we will create two classes,<\/p><h2>ABC SMS Service<\/h2><p>Create a class <span style=\"color: #e83e8c;\">app\/Services\/ABCSMSService.php<\/span> with the following content,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c609de8 elementor-widget elementor-widget-code-highlight\" data-id=\"c609de8\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><?php\nnamespace App\\Services;\n\nclass ABCSMSService implements SMSServiceContract\n{\n    public function sendSMS($phone, $message)\n    {\n        \/\/ Code here to call API of ABC SMS Provider to send SMS\n    }\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-843d2f1 elementor-widget elementor-widget-text-editor\" data-id=\"843d2f1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2>XYZ SMS Service<\/h2><p>Create a class <span style=\"color: #e83e8c;\">app\/Services\/XYZSMSService.php<\/span> with the following content,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b62c448 elementor-widget elementor-widget-code-highlight\" data-id=\"b62c448\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><?php\nnamespace App\\Services;\n\nclass XYZSMSService implements SMSServiceContract\n{\n    public function sendSMS($phone, $message)\n    {\n        \/\/ Code here to call API of XYZ SMS Provider to send SMS\n    }\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9b8bad2 elementor-widget elementor-widget-text-editor\" data-id=\"9b8bad2\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2>Create Facade to Send SMS<\/h2><p>The third step is to create a Facade to send an SMS. Create a facade class <span style=\"color: #e83e8c;\">app\/Facades\/SMSGateway.php<\/span> with the following content,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fd31e23 elementor-widget elementor-widget-code-highlight\" data-id=\"fd31e23\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><?php\nnamespace App\\Facades;\n\nuse App\\Services\\Contracts\\SMSServiceContract;\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass SMSGateway extends Facade\n{\n    \/**\n      Get the registered name of the component.\n\n      @return string\n     \/\n    protected static function getFacadeAccessor()\n    {\n        return SMSServiceContract::class;\n    }\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fcfc3cd elementor-widget elementor-widget-text-editor\" data-id=\"fcfc3cd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Here, note that we are giving <span style=\"color: #e83e8c;\">SMSServiceContract<\/span> class name as a facade assessor. So we will need to use that same class name while binding it to the real implementation in our service provider.<\/p><h2>Define SMS Driver in config<\/h2><p>We need to define our SMS Driver into our config file. You can create a new config file or can use <span style=\"color: #e83e8c;\">config\/services.php<\/span>. To keep it simple, we will define it in services.php. I will add the following content at the end of the file before the closing bracket. so it will look like something,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7be1461 elementor-widget elementor-widget-code-highlight\" data-id=\"7be1461\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><?php\nreturn [undefined]<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-828b5f6 elementor-widget elementor-widget-text-editor\" data-id=\"828b5f6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2>Define your driver in .env file<\/h2><p>Update your <span style=\"color: #e83e8c;\">.env<\/span> file and add <span style=\"color: #e83e8c;\">SMS_SERVICE<\/span> variable, something like<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1d80669 elementor-widget elementor-widget-code-highlight\" data-id=\"1d80669\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>SMS_SERVICE=abc<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-46a9d99 elementor-widget elementor-widget-text-editor\" data-id=\"46a9d99\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2>Create\/Modify Service Provider<\/h2><p>The final step here is, we need to either create our own service provider and add it to <span style=\"color: #e83e8c;\">config\/app.php<\/span> or we can use <span style=\"color: #e83e8c;\">AppServiceProvider.php<\/span> as well. To keep it simple let&#8217;s add it to AppServiceProvider.<\/p><p>In <span style=\"color: #e83e8c;\">app\/Providers\/AppServiceProvider.php<\/span> we will add the following code under the <span style=\"color: #e83e8c;\">register<\/span> method,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3ce0ef1 elementor-widget elementor-widget-code-highlight\" data-id=\"3ce0ef1\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>$this->app->bind(SMSServiceContract::class, \nfunction ($app) \n  {     \n     if (config('services.sms') == 'abc') \n     {         \n          return new ABCSMSService();     \n     } else {        \n          return new XYZSMSService();     \n     } \n});<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2eb5e4d elementor-widget elementor-widget-text-editor\" data-id=\"2eb5e4d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Note: Do not forget to import all these classes at the top.<\/p><p>And that&#8217;s it.<\/p><h2>Usage<\/h2><p>Now you can use your Facade to send the SMS.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-97cdcd8 elementor-widget elementor-widget-code-highlight\" data-id=\"97cdcd8\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>\\App\\Facades\\SMSGateway::sendSMS($phoneNumber, $message);<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-661d253 elementor-widget elementor-widget-text-editor\" data-id=\"661d253\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Or if you made an alias,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-26b69fc elementor-widget elementor-widget-code-highlight\" data-id=\"26b69fc\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>\\SMSGateway::sendSMS($phoneNumber, $message);<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6e1392c elementor-widget elementor-widget-text-editor\" data-id=\"6e1392c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2>Change service provider<\/h2><p>Now if you want to change your service provider, all you need to do is, just go to the <span style=\"color: #e83e8c;\">.env<\/span> and change the provider to <span style=\"color: #e83e8c;\">xyz<\/span> and it will use the <span style=\"color: #e83e8c;\">XYZSMSService<\/span> class to send the SMS.<\/p><p>I hope this will help to understand Laravel Service Providers and Facade in a much better way.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>How to create a laravel facade with a service provider to use multiple SMS services as an SMS&#8230;<\/p>\n","protected":false},"author":2,"featured_media":3650,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"two_page_speed":[],"footnotes":""},"categories":[9],"tags":[115,116],"class_list":["post-3648","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-laravel-facades","tag-service-providers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SMS Driver with Laravel Facades and Service Providers<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SMS Driver with Laravel Facades and Service Providers\" \/>\n<meta property=\"og:description\" content=\"How to create a laravel facade with a service provider to use multiple SMS services as an SMS...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | InfyOm Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/infyom\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-08T09:44:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-14T11:24:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png\" \/>\n\t<meta property=\"og:image:width\" content=\"772\" \/>\n\t<meta property=\"og:image:height\" content=\"484\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InfyOm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfyOm\" \/>\n<meta name=\"twitter:site\" content=\"@InfyOm\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InfyOm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\"},\"author\":{\"name\":\"InfyOm\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754\"},\"headline\":\"SMS Driver with Laravel Facades and Service Providers\",\"datePublished\":\"2019-11-08T09:44:33+00:00\",\"dateModified\":\"2024-08-14T11:24:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\"},\"wordCount\":547,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/infyom.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png\",\"keywords\":[\"Laravel Facades\",\"Service Providers\"],\"articleSection\":[\"Laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\",\"url\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\",\"name\":\"SMS Driver with Laravel Facades and Service Providers\",\"isPartOf\":{\"@id\":\"https:\/\/infyom.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png\",\"datePublished\":\"2019-11-08T09:44:33+00:00\",\"dateModified\":\"2024-08-14T11:24:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage\",\"url\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png\",\"contentUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png\",\"width\":772,\"height\":484,\"caption\":\"SMS Driver with Laravel Facades and Service Providers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/infyom.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SMS Driver with Laravel Facades and Service Providers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/infyom.com\/blog\/#website\",\"url\":\"https:\/\/infyom.com\/blog\/\",\"name\":\"Blog | InfyOm Technologies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/infyom.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/infyom.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/infyom.com\/blog\/#organization\",\"name\":\"InfyOm Technologies\",\"url\":\"https:\/\/infyom.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png\",\"contentUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png\",\"width\":88,\"height\":41,\"caption\":\"InfyOm Technologies\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/infyom\",\"https:\/\/x.com\/InfyOm\",\"https:\/\/www.instagram.com\/infyomtechnologies\/\",\"https:\/\/in.linkedin.com\/company\/infyom-technologies\",\"https:\/\/github.com\/infyomlabs\",\"https:\/\/x.com\/infyom\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754\",\"name\":\"InfyOm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g\",\"caption\":\"InfyOm\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SMS Driver with Laravel Facades and Service Providers","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/","og_locale":"en_US","og_type":"article","og_title":"SMS Driver with Laravel Facades and Service Providers","og_description":"How to create a laravel facade with a service provider to use multiple SMS services as an SMS...","og_url":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/","og_site_name":"Blog | InfyOm Technologies","article_publisher":"https:\/\/www.facebook.com\/infyom","article_published_time":"2019-11-08T09:44:33+00:00","article_modified_time":"2024-08-14T11:24:56+00:00","og_image":[{"width":772,"height":484,"url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png","type":"image\/png"}],"author":"InfyOm","twitter_card":"summary_large_image","twitter_creator":"@InfyOm","twitter_site":"@InfyOm","twitter_misc":{"Written by":"InfyOm","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#article","isPartOf":{"@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/"},"author":{"name":"InfyOm","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754"},"headline":"SMS Driver with Laravel Facades and Service Providers","datePublished":"2019-11-08T09:44:33+00:00","dateModified":"2024-08-14T11:24:56+00:00","mainEntityOfPage":{"@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/"},"wordCount":547,"commentCount":0,"publisher":{"@id":"https:\/\/infyom.com\/blog\/#organization"},"image":{"@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage"},"thumbnailUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png","keywords":["Laravel Facades","Service Providers"],"articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/","url":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/","name":"SMS Driver with Laravel Facades and Service Providers","isPartOf":{"@id":"https:\/\/infyom.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage"},"image":{"@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage"},"thumbnailUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png","datePublished":"2019-11-08T09:44:33+00:00","dateModified":"2024-08-14T11:24:56+00:00","breadcrumb":{"@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#primaryimage","url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png","contentUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/sms-driver-with-laravel-facades-and-service-providers.png","width":772,"height":484,"caption":"SMS Driver with Laravel Facades and Service Providers"},{"@type":"BreadcrumbList","@id":"https:\/\/infyom.com\/blog\/sms-driver-with-laravel-facades-and-service-providers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/infyom.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SMS Driver with Laravel Facades and Service Providers"}]},{"@type":"WebSite","@id":"https:\/\/infyom.com\/blog\/#website","url":"https:\/\/infyom.com\/blog\/","name":"Blog | InfyOm Technologies","description":"","publisher":{"@id":"https:\/\/infyom.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/infyom.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/infyom.com\/blog\/#organization","name":"InfyOm Technologies","url":"https:\/\/infyom.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png","contentUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png","width":88,"height":41,"caption":"InfyOm Technologies"},"image":{"@id":"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/infyom","https:\/\/x.com\/InfyOm","https:\/\/www.instagram.com\/infyomtechnologies\/","https:\/\/in.linkedin.com\/company\/infyom-technologies","https:\/\/github.com\/infyomlabs","https:\/\/x.com\/infyom"]},{"@type":"Person","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754","name":"InfyOm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g","caption":"InfyOm"}}]}},"_links":{"self":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/3648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/comments?post=3648"}],"version-history":[{"count":9,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/3648\/revisions"}],"predecessor-version":[{"id":6018,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/3648\/revisions\/6018"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/media\/3650"}],"wp:attachment":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/media?parent=3648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/categories?post=3648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/tags?post=3648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}