Skip to content

Commit

Permalink
fix(namespace): move craftsys\msg91 to craftsys\msg91client namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sudkumar committed Oct 19, 2019
1 parent 09d22f6 commit d7d866a
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 27 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ Once you have [Configured](#configuration), client can be initialised by passing
$config = [
'key' => "123456789012345678901234",
];
$client = new Craftsys\MSG91\Client($config);
$client = new Craftsys\MSG91Client\Client($config);
```

The package in distributed under `Craftsys\MSG91` namespace which can used if your are working in a namespace environment.
The package in distributed under `Craftsys\MSG91Client` namespace which can used if your are working in a namespace environment.

```php
<?php
// in your use statement sections
use Craftsys\MSG91\Client;
use Craftsys\MSG91Client\Client;

// somewhere in this source file where you need the client
$client = new Client();
Expand All @@ -90,13 +90,13 @@ Next, follow along with [examples](#examples) to learn more
The client is responsible for interacting with MSG91 apis.

```php
$client = new Craftsys\MSG91\Client($config);
$client = new Craftsys\MSG91Client\Client($config);
```

Client can also be initialised without a configuration which can be set by calling `setConfig($config)` method on the client instance.

```php
$client = new Craftsys\MSG91\Client();
$client = new Craftsys\MSG91Client\Client();
$client->setConfig($config);
```

Expand All @@ -105,7 +105,7 @@ $client->setConfig($config);
You can also pass a custom `GuzzleHttp\Client` as the second argument on the Client's constructor.

```php
$client = new Craftsys\MSG91\Client($config, new GuzzleHttp\Client());
$client = new Craftsys\MSG91Client\Client($config, new GuzzleHttp\Client());
```

### Managing OTPs
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"Craftsys\\MSG91\\": "src/"
"Craftsys\\MSG91Client\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Craftsys\\MSG91\\Test\\": "tests/"
"Craftsys\\MSG91Client\\Test\\": "tests/"
}
},
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/BaseMessage.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

use Craftsys\MSG91\Exceptions\ConnectionError;
use Craftsys\MSG91\Exceptions\ResponseError;
use Craftsys\MSG91\Exceptions\AuthKeyRequired;
use Craftsys\MSG91Client\Exceptions\ConnectionError;
use Craftsys\MSG91Client\Exceptions\ResponseError;
use Craftsys\MSG91Client\Exceptions\AuthKeyRequired;
use Exception;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Exception\ClientException;
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

use GuzzleHttp\Client as HttpClient;

Expand Down
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

class Config
{
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/AuthKeyRequired.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91\Exceptions;
namespace Craftsys\MSG91Client\Exceptions;

use Exception;

Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ConnectionError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91\Exceptions;
namespace Craftsys\MSG91Client\Exceptions;

use Exception;
use GuzzleHttp\Exception\ClientException;
Expand Down
3 changes: 1 addition & 2 deletions src/Exceptions/ResponseError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91\Exceptions;
namespace Craftsys\MSG91Client\Exceptions;

use Exception;

Expand All @@ -11,7 +11,6 @@ class ResponseError extends Exception
*/
public function __construct(?string $message = "")
{
echo $message;
return new Exception("MSG91 responded with an error. `{$message}`");
}
}
2 changes: 1 addition & 1 deletion src/Message.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

class Message extends BaseMessage
{
Expand Down
2 changes: 1 addition & 1 deletion src/OTPMessage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

use GuzzleHttp\Client as HttpClient;

Expand Down
2 changes: 1 addition & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

use Psr\Http\Message\ResponseInterface;
use Exception;
Expand Down
2 changes: 1 addition & 1 deletion src/URLs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91;
namespace Craftsys\MSG91Client;

class URLs
{
Expand Down
4 changes: 2 additions & 2 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craftsys\MSG91\Test;
namespace Craftsys\MSG91Client\Test;

use Craftsys\MSG91\Config;
use Craftsys\MSG91Client\Config;

class ConfigTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/OtpServiceTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craftsys\MSG91\Test;
namespace Craftsys\MSG91Client\Test;

use Craftsys\MSG91\Client;
use Craftsys\MSG91Client\Client;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craftsys\MSG91\Test;
namespace Craftsys\MSG91Client\Test;

use PHPUnit\Framework\TestCase as BaseTestCase;

Expand Down

0 comments on commit d7d866a

Please sign in to comment.