Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
omakei committed Jan 3, 2022
1 parent f95ab1e commit f9d3222
Show file tree
Hide file tree
Showing 38 changed files with 1,219 additions and 338 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: :vendor_name
github: omakei
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
url: https://github.com/omakei/laravel-nextsms/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
url: https://github.com/omakei/laravel-nextsms/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/:vendor_name/:package_name/security/policy
url: https://github.com/omakei/laravel-nextsms/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/:vendor_name/:package_name/issues/new
url: https://github.com/omakei/laravel-nextsms/issues/new
about: Report a reproducable bug
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Security Policy

If you discover any security related issues, please email author@domain.com instead of using the issue tracker.
If you discover any security related issues, please email omakei96@gmail.com instead of using the issue tracker.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `:package_name` will be documented in this file.
All notable changes to `laravel-nextsms` will be documented in this file.

## 1.0.0 - 202X-XX-XX

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) :vendor_name <author@domain.com>
Copyright (c) omakei <omakei96@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
241 changes: 203 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,236 @@
# :package_description

[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/run-tests?label=tests)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/Check%20&%20fix%20styling?label=code%20style)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
<!--delete-->
---
This repo can be used to scaffold a Laravel package. Follow these steps to get started:
<p align="center">
<img src="/art/nextsms-logo.png" width="1352" title="NextSMS Logo" alt="NextSMS Logo">
</p>
# Laravel NextSMS

1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files
3. Remove this block of text.
4. Have fun creating your package.
5. If you need help creating a package, consider picking up our <a href="https://laravelpackage.training">Laravel Package Training</a> video course.
---
<!--/delete-->
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
[![Latest Version on Packagist](https://img.shields.io/packagist/v/omakei/laravel-nextsms.svg?style=flat-square)](https://packagist.org/packages/omakei/laravel-nextsms)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/omakei/laravel-nextsms/run-tests?label=tests)](https://github.com/omakei/laravel-nextsms/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/omakei/laravel-nextsms/Check%20&%20fix%20styling?label=code%20style)](https://github.com/omakei/laravel-nextsms/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/omakei/laravel-nextsms.svg?style=flat-square)](https://packagist.org/packages/omakei/laravel-nextsms)

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/:package_name.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/:package_name)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
Laravel package to send SMS using NextSMS API.

## Installation

You can install the package via composer:

```bash
composer require :vendor_slug/:package_slug
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag=":package_slug-migrations"
php artisan migrate
composer require omakei/laravel-nextsms
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag=":package_slug-config"
php artisan vendor:publish --tag="laravel-nextsms-config"
```

Optionally, you can publish the views using
The following keys must be available in your `.env` file:

```bash
php artisan vendor:publish --tag=":package_slug-views"
NEXTSMS_USERNAME=
NEXTSMS_PASSWORD=
NEXTSMS_SENDER_ID=
```

This is the contents of the published config file:
This is the contents of the published `config` file:

```php
return [
'username' => env('NEXTSMS_USERNAME', 'NEXTSMS'),
'password' => env('NEXTSMS_PASSWORD', 'NEXTSMS'),
'api_key' => base64_encode(env('NEXTSMS_USERNAME', 'NEXTSMS').':'.env('NEXTSMS_PASSWORD', 'NEXTSMS')),
'sender_id' => env('NEXTSMS_SENDER_ID', 'NEXTSMS'),
'url' => [
'sms' => [
'single' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/text/single',
'multiple' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/text/multi',
'reports' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/reports',
'logs' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/logs',
'balance' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/balance',
],
'sub_customer' => [
'create' => NextSMS::NEXTSMS_BASE_URL.'/api/reseller/v1/sub_customer/create',
'recharge' => NextSMS::NEXTSMS_BASE_URL.'/api/reseller/v1/sub_customer/recharge',
'deduct' => NextSMS::NEXTSMS_BASE_URL.'/api/reseller/v1/sub_customer/deduct',
]
],
];
```

## Usage

### Send SMS

Sending single sms to single destination:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendSingleSMS(['to' => '255625933171', 'text' => 'Dj Omakei is texting.']);

```

Sending single sms to multiple destinations:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendSingleSMSToMultipleDestination([
'to' => ['255625933171','255656699895'],
'text' => 'Dj Omakei is texting.']);

```

Sending multiple sms to multiple destinations (Example 1):

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendMultipleSMSToMultipleDestinations(['messages' => [
['to' => '255625933171', 'text' => 'Dj Omakei is texting.'],
['to' => '255656699895', 'text' => 'Dj Omakei is texting.']
]]);

```

Sending multiple sms to multiple destinations (Example 2):

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendMultipleSMSToMultipleDestinations(['messages' => [
['to' => ['255625933171','255656699895'], 'text' => 'Dj Omakei is texting.'],
['to' => '255625933171', 'text' => 'Dj Omakei is texting.']
]]);

```

Schedule sms:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::scheduleSMS([
'to' => '255625933171',
'text' => 'Dj Omakei is texting.',
'date' => '2022-01-25' ,
'time' => '12:00']);

```

### SMS Delivery Reports

Get all delivery reports:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::getAllDeliveryReports();

```

Get delivery reports with messageId:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::getDeliveryReportWithMessageId(243452542526627);

```

Get delivery reports with messageId:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::getDeliveryReportWithSpecificDateRange('2022-01-25', '2022-01-29');

```

### Sent Sms Logs

Get all sent SMS logs:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::getAllSentSMSLogs(10, 5);

```

Get all sent SMS logs with the optional parameter:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::getAllSentSMSLogsWithOptionalParameter('255625933171','2022-01-25', '2022-01-29',10, 5);

```

### Sub Customer

Register Sub Customer:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::subCustomerCreate(
'Michael',
'Omakei',
'omakei',
'[email protected]',
'06259313171',
'Sub Customer (Reseller)',
100);

```

Recharge customer:

```php
$skeleton = new VendorName\Skeleton();
echo $skeleton->echoPhrase('Hello, VendorName!');

use Omakei\NextSMS\NextSMS;

$response = NextSMS::subCustomerRecharge('[email protected]', 100);

```

Deduct a customer:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::subCustomerDeduct('[email protected]', 100);

```

Get sms balance:

```php

use Omakei\NextSMS\NextSMS;

$response = NextSMS::getSMSBalance();

```

## NextSMS API Documentation

Please see [NextSMS Developer API](https://documenter.getpostman.com/view/4680389/SW7dX7JL#2936eed4-6027-45e7-92c9-fe1cd7df140b) for more details.

## Testing

```bash
Expand All @@ -86,7 +251,7 @@ Please review [our security policy](../../security/policy) on how to report secu

## Credits

- [:author_name](https://github.com/:author_username)
- [omakei](https://github.com/omakei)
- [All Contributors](../../contributors)

## License
Expand Down
Binary file added art/nextsms-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 13 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": ":vendor_slug/:package_slug",
"description": ":package_description",
"name": "omakei/laravel-nextsms",
"description": "A Laravel package to send SMS using NextSMS API ",
"keywords": [
":vendor_name",
"omakei",
"laravel",
":package_slug"
"laravel-nextsms"
],
"homepage": "https://github.com/:vendor_slug/:package_slug",
"homepage": "https://github.com/omakei/laravel-nextsms",
"license": "MIT",
"authors": [
{
"name": ":author_name",
"email": "author@domain.com",
"name": "omakei",
"email": "omakei96@gmail.com",
"role": "Developer"
}
],
Expand All @@ -26,6 +26,7 @@
"orchestra/testbench": "^6.22",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"pestphp/pest-plugin-mock": "^1.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
Expand All @@ -34,13 +35,13 @@
},
"autoload": {
"psr-4": {
"VendorName\\Skeleton\\": "src",
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories"
"Omakei\\NextSMS\\": "src",
"Omakei\\NextSMS\\Database\\Factories\\": "database/factories"
}
},
"autoload-dev": {
"psr-4": {
"VendorName\\Skeleton\\Tests\\": "tests"
"Omakei\\NextSMS\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -54,10 +55,10 @@
"extra": {
"laravel": {
"providers": [
"VendorName\\Skeleton\\SkeletonServiceProvider"
"Omakei\\NextSMS\\NextSMSServiceProvider"
],
"aliases": {
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton"
"NextSMS": "Omakei\\NextSMS\\Facades\\NextSMS"
}
}
},
Expand Down
Loading

0 comments on commit f9d3222

Please sign in to comment.