Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USSD V3 #39

Merged
merged 25 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ac7088d
Version 3.0 wip
cybersai Dec 20, 2023
10e23ec
Try github actions for testing
cybersai Dec 20, 2023
55eee5f
Update build badges
cybersai Dec 20, 2023
3bdecec
Listing pagination aid
cybersai Dec 21, 2023
c6dbc24
Limit content aid
cybersai Dec 21, 2023
11091af
Making limit content, paginate and terminate play nice together
cybersai Dec 22, 2023
c1b700e
Format code with php cs fixer
cybersai Dec 22, 2023
a6baf19
Trim output and add conditional trait
cybersai Dec 23, 2023
fd6bf20
Validate continuing mode
cybersai Dec 23, 2023
5f2f9e3
Refector to use method for exception-handler and response
cybersai Dec 23, 2023
a114a5e
Import InvalidArgumentException in Testing
cybersai Dec 23, 2023
74e95a3
Specify PHP version
cybersai Dec 23, 2023
0e87ac6
Use decision instead of string for continuing state
cybersai Dec 27, 2023
b701ae4
Allow creating state or action as initial state with option
cybersai Dec 28, 2023
1250739
Formatting menu helper and caching current page
cybersai Jan 20, 2024
5c202f2
Rename LimitContent to Truncate and add testing util for time waiting
cybersai Jan 20, 2024
fc0d1c1
Timeout resumation is based on last session and not begining of session
cybersai Jan 20, 2024
564db53
Add exception handler command and refactor command tests
cybersai Jan 20, 2024
91c2a05
Make Ussd useContext chainable and put exception handlers in the ussd…
cybersai Jan 21, 2024
b0b2316
Typehint functions
cybersai Jan 21, 2024
ba6a4b0
Use docblock for ServiceProvider
cybersai Jan 21, 2024
9b3d169
Better exceptions
cybersai Jan 21, 2024
fa7f099
Improve readme
cybersai Jan 21, 2024
4fb58c4
Move some of Ussd functionality to UssdBuilder
cybersai Jan 21, 2024
886a6df
Merge branch 'develop' into 3.x
cybersai Jan 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests

on:
push:
branches: [ "3.x" ]
pull_request:
branches: [ "3.x" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: composer run-script test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/vendor
composer.lock
.phpunit.result.cache
.php-cs-fixer.cache
testbench/
/coverage
.DS_Store
13 changes: 13 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'@PHP80Migration' => true,
'yoda_style' => true,
'no_unused_imports' => true,
'ordered_imports' => true,
'ordered_class_elements' => true,
'ordered_types' => true,
])
->setFinder((new PhpCsFixer\Finder())->in(__DIR__ . '/src'));
27 changes: 24 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ All notable changes to `laravel Ussd` will be documented in this file.

## [Unreleased]

## [v3.0.0-beta.1] - 2024-01-21
### Removed
- Removed machine in favor of USSD facade.

### Changed
- Changed state interface.
- Changed record implementation and public apis.
- Changed config variables

### Added
- Added `Transition`, `Paginate`, `Truncate` and `Terminate` Attributes.
- Added Custom Exception Handling.
- Added command to create responses, exception handlers and decisions.
- Added decision classes for navigating USSD menus.
- Added testing utility to Ussd Facade.
- Added pagination utility.
- Added resumability of timed-out sessions.
- Added interfaces for decision, exception handler, response, initial state and initial action.
- Added support for dependency injection.
- Added USSD context.

## [v2.5.0] - 2022-06-19
### Added
- Add configuring USSDs using decorator pattern.
Expand All @@ -17,13 +38,11 @@ All notable changes to `laravel Ussd` will be documented in this file.
- Clean up

## [v2.4.0] - 2022-02-22

### Added
- Add Laravel 9 support
- Add PHP 8.1 support

## [v2.3.1] - 2021-10-15

### Fixed
- Coding style

Expand All @@ -50,6 +69,7 @@ All notable changes to `laravel Ussd` will be documented in this file.
- Artisan command to create action class
- increment method to records
- decrement method to records

### Changed
- config file class namespace split to action and state namespace
- Updated changelog
Expand Down Expand Up @@ -82,7 +102,8 @@ All notable changes to `laravel Ussd` will be documented in this file.
- Ussd config to allow developers customize behaviour
- Ussd service Provider class to allow laravel know how to integrate the package

[Unreleased]: ../../compare/v2.5.0...HEAD
[Unreleased]: ../../compare/v3.0.0-beta.1...HEAD
[v3.0.0-beta.1]: ../../compare/v2.5.0...v3.0.0-beta.1
[v2.5.0]: ../../compare/v2.4.2...v2.5.0
[v2.4.2]: ../../compare/v2.4.1...v2.4.2
[v2.4.1]: ../../compare/v2.4.0...v2.4.1
Expand Down
26 changes: 16 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@
"license": "MIT",
"authors": [
{
"name": "Sparors Inc",
"name": "Isaac Sai",
"email": "[email protected]",
"homepage": "https://sparors.github.io"
},
{
"name": "Benjamin Manford",
"email": "[email protected]",
"homepage": "https://sparors.github.io"
}
],
"homepage": "https://github.com/sparors/laravel-ussd",
"keywords": ["Laravel", "Ussd"],
"require": {
"illuminate/support": "~5|~6|~7|~8|~9|~10"
"php": "^8.0",
"illuminate/support": "~8|~9|~10"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"mockery/mockery": "^1.1",
"orchestra/testbench": "~3|~4|~5|~6|~7|~8",
"sempro/phpunit-pretty-print": "^1.0"
"phpunit/phpunit": "^9.6",
"orchestra/testbench": "~6|~7|~8",
"friendsofphp/php-cs-fixer": "^3.41"
},
"autoload": {
"psr-4": {
Expand All @@ -34,10 +39,11 @@
"laravel": {
"providers": [
"Sparors\\Ussd\\UssdServiceProvider"
],
"aliases": {
"Ussd": "Sparors\\Ussd\\Facades\\Ussd"
}
]
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"format": "vendor/bin/php-cs-fixer fix"
}
}
49 changes: 6 additions & 43 deletions config/ussd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,25 @@

/*
|--------------------------------------------------------------------------
| State Class Namespace
| USSD Namespace
|--------------------------------------------------------------------------
|
| This value sets the root namespace for Ussd State component classes in
| your application.
| This sets the root namespace for USSD component classes.
|
*/

'state_namespace' => env('USSD_STATE_NS', 'App\\Http\\Ussd\\States'),
'namespace' => env('USSD_NAMESPACE', 'App\Ussd'),

/*
|--------------------------------------------------------------------------
| Action Class Namespace
|--------------------------------------------------------------------------
|
| This value sets the root namespace for Ussd Action component classes in
| your application.
|
*/

'action_namespace' => env('USSD_ACTION_NS', 'App\\Http\\Ussd\\Actions'),

/*
|--------------------------------------------------------------------------
| Store
| Record Store
|--------------------------------------------------------------------------
|
| This value sets the default store to use for the ussd record.
| The store can be found in your cache stores config
| This sets the cache store to be used by USSD Record.
|
*/

'cache_store' => env('USSD_STORE', null),


/*
|--------------------------------------------------------------------------
| Time to live
|--------------------------------------------------------------------------
|
| This value sets the default for how long the record values are to
| be cached in your application when not specified.
|
*/

'cache_ttl' => env('USSD_TTL', null),

/*
|--------------------------------------------------------------------------
| Default value
|--------------------------------------------------------------------------
|
| This value return the default store value when a given cache key
| is not found
|
*/
'record_store' => env('USSD_STORE'),

'cache_default' => env('USSD_DEFAULT_VALUE', null),
];
1 change: 0 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Contributions are accepted via Pull Requests on [Github](https://github.com/spar

# Things you could do
If you want to contribute but do not know where to start, this list provides some starting points.
- Set up TravisCI
- Write a comprehensive ReadMe

## Pull Requests
Expand Down
16 changes: 7 additions & 9 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
testdox="true"
processIsolation="false"
stopOnFailure="false"
printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd">
<coverage>
<include>
<directory>src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Package">
<directory suffix=".php">./tests/</directory>
<testsuite name="Unit">
<directory suffix=".php">./tests/Unit/</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix=".php">./tests/Integration/</directory>
</testsuite>
</testsuites>
</phpunit>
Loading