Skip to content

Commit 1b73745

Browse files
committed
feat(namespace): change in namespace
1 parent f60f9d4 commit 1b73745

File tree

8 files changed

+138
-123
lines changed

8 files changed

+138
-123
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_size = 2

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# Laravel service provider for MSG91
1+
# Laravel service provider for Msg91
22

33
_This library requires a minimum PHP version of 7.1_
44

5-
This is a **[laravel](https://laravel.com) service provider** for [MSG91 APIs](https://docs.msg91.com/collection/msg91-api-integration/5/pages/139). It wraps the [msg91-php][client] client and provides the same functionality for Laravel applications by exposing a Service Provider and Facade.
5+
This is a **[laravel](https://laravel.com) service provider** for [Msg91 APIs](https://docs.msg91.com/collection/msg91-api-integration/5/pages/139). It wraps the [msg91-php][client] client and provides the same functionality for Laravel applications by exposing a Service Provider and Facade.
66

77
> **NOTE**: The project is under active development and so, some apis are subjected to change before of `v1.0.0` release.
88
99
## Table of Contents
1010

11-
- [Installation](#installation)
12-
- [Configuration](#configuration)
13-
- [Usage](#usage)
14-
- [Examples](#examples)
15-
- [Create a Client](#create-a-client)
16-
- [Managing OTPs](#managing-otps)
17-
- [Send OTP](#send-otp)
18-
- [Verify OTP](#verify-otp)
19-
- [Resend OTP](#resend-otp)
11+
- [Installation](#installation)
12+
- [Configuration](#configuration)
13+
- [Usage](#usage)
14+
- [Examples](#examples)
15+
- [Create a Client](#create-a-client)
16+
- [Managing OTPs](#managing-otps)
17+
- [Send OTP](#send-otp)
18+
- [Verify OTP](#verify-otp)
19+
- [Resend OTP](#resend-otp)
2020

2121
## Installation
2222

@@ -28,31 +28,31 @@ composer require craftsys/msg91-laravel
2828

2929
### Laravel 5.5+
3030

31-
If you're using Laravel 5.5 or above, the package will automatically register the `Craftsys\MSG91Client\Laravel\MSG91ServiceProvider` provider and aliases `Craftsys\MSG91Client\Laravel\Facade` facade to `MSG91`.
31+
If you're using Laravel 5.5 or above, the package will automatically register the `Craftsys\Msg91\Msg91LaravelServiceProvider` provider and aliases `Craftsys\Msg91\Facade\Msg91` facade to `Msg91`.
3232

3333
### Laravel 5.4 and below
3434

35-
Add `Craftsys\MSG91Client\Laravel\MSG91ServiceProvider` to the `providers` array in your `config/app.php`:
35+
Add `Craftsys\Msg91\Msg91LaravelServiceProvider` to the `providers` array in your `config/app.php`:
3636

3737
```php
3838
'providers' => [
3939
// Other service providers...
40-
Craftsys\MSG91Client\Laravel\MSG91ServiceProvider::class,
40+
Craftsys\Msg91\Msg91LaravelServiceProvider::class,
4141
],
4242
```
4343

4444
If you want to use the facade interface, you can `use` the facade class when needed:
4545

4646
```php
47-
use Craftsys\MSG91Client\Laravel\Facade;
47+
use Craftsys\Msg91\Facade\Msg91;
4848
```
4949

5050
Or add an alias in your `config/app.php`
5151

5252
```php
5353
'aliases' => [
5454
// other aliases here
55-
'MSG91' => Craftsys\MSG91Client\Laravel\Facade::class,
55+
'Msg91' => Craftsys\Msg91\Facade\Msg91::class,
5656
],
5757
```
5858

@@ -61,7 +61,7 @@ in an example route or in `php artisan tinker` if you are in Laravel.
6161

6262
```php
6363
// this should print an array of some default configuration values
64-
MSG91::otp()->toArray()
64+
Msg91::otp()->toArray()
6565
```
6666

6767
If there is an issue, please check the steps again or open an issue for support.
@@ -78,21 +78,21 @@ The package can be configured by providing a `msg91` key inside your `config/ser
7878
return [
7979
// along with other services
8080
"msg91": [
81-
'key' => env("MSG91_KEY"),
81+
'key' => env("Msg91_KEY"),
8282
],
8383
];
8484
```
8585

86-
and update the `.env` file to get the desired values e.g. `MSG91_KEY`.
86+
and update the `.env` file to get the desired values e.g. `Msg91_KEY`.
8787

8888
Please visit [msg91-php configuration][client-configuration] for a detailed description about the available options and their default values.
8989

9090
## Usage
9191

92-
Once you have [Configured](#configuration) the Laravel/Lumen application to use the service provider and have aliased the facade to `MSG91`, you will have to [msg91-php][client] client `Craftsys\MSG91\Client`'s instance.
92+
Once you have [Configured](#configuration) the Laravel/Lumen application to use the service provider and have aliased the facade to `Msg91`, you will have to [msg91-php][client] client `Craftsys\Msg91\Client`'s instance.
9393

9494
```php
95-
MSG91::otp()
95+
Msg91::otp()
9696
->to(919999999999)
9797
->send()
9898
```
@@ -118,15 +118,15 @@ MGS91::otp()
118118
### Verify OTP
119119

120120
```php
121-
MSG91::otp(1234) // OTP to be verified
121+
Msg91::otp(1234) // OTP to be verified
122122
->to(912343434312) // phone number with country code
123123
->verify(); // Verify
124124
```
125125

126126
### Resend OTP
127127

128128
```php
129-
MSG91::otp()
129+
Msg91::otp()
130130
->to(912343434312) // set the mobile with country code
131131
->via("text") // way of retry
132132
->resend(); // resend otp

composer.json

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
{
2-
"name": "craftsys/msg91-laravel",
3-
"description": "Laravel service provider for MSG91 apis.",
4-
"license": "MIT",
5-
"type": "library",
6-
"authors": [
7-
{
8-
"name": "Sudhir Mitharwal",
9-
"email": "[email protected]",
10-
"role": "Developer",
11-
"homepage": "http://github.com/sudkumar"
12-
}
13-
],
14-
"keywords": [
15-
"msg91",
16-
"php",
17-
"laravel",
18-
"otp"
19-
],
20-
"homepage": "https://github.com/craftsys/msg91-laravel",
21-
"support": {
22-
"issues": "https://github.com/craftsys/msg91-laravel/issues",
23-
"source": "https://github.com/craftsys/msg91-laravel",
24-
"email": "[email protected]"
25-
},
26-
"require": {
27-
"php": ">=7.1",
28-
"craftsys/msg91-php": "^0.4.2",
29-
"illuminate/support": "^5.2|^6.0"
30-
},
31-
"require-dev": {
32-
"orchestra/testbench": "^4.2",
33-
"phpunit/phpunit": "^8.4"
34-
},
35-
"extra": {
36-
"branch-alias": {
37-
"dev-master": "0.x.x-dev"
2+
"name": "craftsys/msg91-laravel",
3+
"description": "Laravel service provider for Msg91 apis.",
4+
"license": "MIT",
5+
"type": "library",
6+
"authors": [
7+
{
8+
"name": "Sudhir Mitharwal",
9+
"email": "[email protected]",
10+
"role": "Developer",
11+
"homepage": "http://github.com/sudkumar"
12+
}
13+
],
14+
"keywords": [
15+
"msg91",
16+
"php",
17+
"laravel",
18+
"otp"
19+
],
20+
"homepage": "https://github.com/craftsys/msg91-laravel",
21+
"support": {
22+
"issues": "https://github.com/craftsys/msg91-laravel/issues",
23+
"source": "https://github.com/craftsys/msg91-laravel",
24+
"email": "[email protected]"
3825
},
39-
"laravel": {
40-
"aliases": {
41-
"MSG91": "Craftsys\\MSG91Client\\Laravel\\Facade"
42-
},
43-
"providers": [
44-
"Craftsys\\MSG91Client\\Laravel\\MSGServiceProvider"
45-
]
46-
}
47-
},
48-
"config": {
49-
"optimize-autoloader": true,
50-
"sort-packages": true
51-
},
52-
"prefer-stable": true,
53-
"minimum-stability": "dev",
54-
"autoload": {
55-
"psr-4": {
56-
"Craftsys\\MSG91Client\\Laravel\\": "src/"
57-
}
58-
},
59-
"autoload-dev": {
60-
"psr-4": {
61-
"Craftsys\\MSG91Client\\Laravel\\Test\\": "tests/"
26+
"require": {
27+
"php": ">=7.1",
28+
"craftsys/msg91-php": "^0.5",
29+
"illuminate/support": "^5.2|^6.0"
30+
},
31+
"require-dev": {
32+
"orchestra/testbench": "^4.2",
33+
"phpunit/phpunit": "^8.4"
34+
},
35+
"config": {
36+
"optimize-autoloader": true,
37+
"sort-packages": true
38+
},
39+
"prefer-stable": true,
40+
"minimum-stability": "dev",
41+
"autoload": {
42+
"psr-4": {
43+
"Craftsys\\Msg91\\": "src/"
44+
}
45+
},
46+
"autoload-dev": {
47+
"psr-4": {
48+
"Craftsys\\Tests\\Msg91\\": "tests/"
49+
}
50+
},
51+
"extra": {
52+
"branch-alias": {
53+
"dev-master": "0.x.x-dev"
54+
},
55+
"laravel": {
56+
"aliases": {
57+
"Msg91": "Craftsys\\Msg91\\Facade\\Msg91"
58+
},
59+
"providers": [
60+
"Craftsys\\Msg91\\Msg91LaravelServiceProvider"
61+
]
62+
}
63+
},
64+
"scripts": {
65+
"test": "phpunit --colors=always"
6266
}
63-
},
64-
"scripts": {
65-
"test": "phpunit --colors=always"
66-
}
6767
}

src/Facade.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Facade/Msg91.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Craftsys\Msg91\Facade;
4+
5+
use Craftsys\Msg91\Client;
6+
use Illuminate\Support\Facades\Facade;
7+
8+
/**
9+
* Facade for Craftsys\Msg91\Client
10+
*
11+
* @method static \Craftsys\Msg91\OTPMessage otp(int|null $otp = null)
12+
*/
13+
class Msg91 extends Facade
14+
{
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*
20+
* @throws \RuntimeException
21+
*/
22+
protected static function getFacadeAccessor()
23+
{
24+
return Client::class;
25+
}
26+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Craftsys\MSG91Client\Laravel;
3+
namespace Craftsys\Msg91;
44

5-
use Craftsys\MSG91Client\Client;
5+
use Craftsys\Msg91\Client;
66
use Illuminate\Support\ServiceProvider;
77

8-
class MSGServiceProvider extends ServiceProvider
8+
class Msg91LaravelServiceProvider extends ServiceProvider
99
{
1010
/**
1111
* Register the application services.
@@ -14,7 +14,7 @@ class MSGServiceProvider extends ServiceProvider
1414
*/
1515
public function register()
1616
{
17-
// Bind MSG91 Client in Service Container.
17+
// Bind Msg91 Client in Service Container.
1818
$this->app->singleton(Client::class, function ($app) {
1919
$config = $app['config'];
2020
return new Client($config->get('services.msg91'));

tests/ServiceProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace Craftsys\MSG91Client\Laravel\Test;
3+
namespace Craftsys\Tests\Msg91;
44

5-
use Craftsys\MSG91Client\Client;
5+
use Craftsys\Msg91\Client;
66

77
class ServiceProviderTest extends TestCase
88
{

tests/TestCase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
namespace Craftsys\MSG91Client\Laravel\Test;
3+
namespace Craftsys\Tests\Msg91;
44

55
use Orchestra\Testbench\TestCase as BaseTestCase;
6-
use Craftsys\MSG91Client\Laravel\MSGServiceProvider;
7-
use Craftsys\MSG91Client\Laravel\Facade;
6+
use Craftsys\Msg91\Msg91LaravelServiceProvider as ServiceProvider;
7+
use Craftsys\Msg91\Facade\Msg91 as Facade;
88

99
abstract class TestCase extends BaseTestCase
1010
{
@@ -18,7 +18,7 @@ abstract class TestCase extends BaseTestCase
1818
protected function getPackageProviders($app)
1919
{
2020
return [
21-
MSGServiceProvider::class,
21+
ServiceProvider::class,
2222
];
2323
}
2424

@@ -32,7 +32,7 @@ protected function getPackageProviders($app)
3232
protected function getPackageAliases($app)
3333
{
3434
return [
35-
'MSG91' => Facade::class
35+
'Msg91' => Facade::class
3636
];
3737
}
3838
}

0 commit comments

Comments
 (0)