diff --git a/changelog.md b/changelog.md index 242c710..07ed52e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog -All notable changes to `LaravelUSSD` will be documented in this file. +All notable changes to `LaravelUssd` will be documented in this file. ## Version 1.0 diff --git a/composer.json b/composer.json index 93c41bf..745daa6 100644 --- a/composer.json +++ b/composer.json @@ -1,47 +1,44 @@ { - "name": "cybersai/laravel-ussd", - "description": "A Laravel package that speed up the development process for USSD", + "name": "cybersai/laravelussd", + "description": "Quick Ussd apps", "license": "MIT", "authors": [ { "name": "Isaac Adzah Sai", "email": "isaacsai030@gmail.com", - "role": "Developer" + "homepage": "author homepage" } ], "homepage": "https://github.com/cybersai/laravelussd", - "keywords": [ - "laravel", - "laravel-ussd", - "ussd", - "framework" - ], - "minimum-stability": "alpha", + "keywords": ["Laravel", "LaravelUssd"], "require": { "illuminate/support": "~5|~6", - "cybersai/ussd": "~1.2" + "cybersai/ussd": "@dev" }, "require-dev": { - "phpunit/phpunit": "~7.0", + "phpunit/phpunit": "^8.0", "mockery/mockery": "^1.1", - "orchestra/testbench": "~3.0", + "orchestra/testbench": "~3|~4", "sempro/phpunit-pretty-print": "^1.0" }, "autoload": { "psr-4": { - "CyberSai\\LaravelUssd\\": "src/" + "Cybersai\\LaravelUssd\\": "src/" } }, "autoload-dev": { "psr-4": { - "CyberSai\\LaravelUssd\\Tests\\": "tests" + "Cybersai\\LaravelUssd\\Tests\\": "tests" } }, "extra": { "laravel": { "providers": [ - "CyberSai\\LaravelUssd\\UssdServiceProvider" - ] + "Cybersai\\LaravelUssd\\LaravelUssdServiceProvider" + ], + "aliases": { + "LaravelUssd": "Cybersai\\LaravelUssd\\Facades\\LaravelUssd" + } } } -} \ No newline at end of file +} diff --git a/config/ussd.php b/config/ussd.php index 1c257dc..035fcd5 100644 --- a/config/ussd.php +++ b/config/ussd.php @@ -1,5 +1,5 @@ env('USSD_PROVIDER', 'korba') -]; + // +]; \ No newline at end of file diff --git a/readme.md b/readme.md index a51f94e..77167d8 100644 --- a/readme.md +++ b/readme.md @@ -1,77 +1,22 @@ -# Laravel USSD Package +# LaravelUssd [![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] [![Build Status][ico-travis]][link-travis] +[![StyleCI][ico-styleci]][link-styleci] -Easily build USSD apps with PHP[Laravel]. +This is where your description should go. Take a look at [contributing.md](contributing.md) to see a to do list. ## Installation -You can install the package via composer: +Via Composer ``` bash -$ composer require cybersai/laravel-ussd +$ composer require cybersai/laravelussd ``` -The package will automatically register itself. - -You can optionally publish the config file with: -```bash -php artisan vendor:publish --provider="CyberSai\LaravelUssd\UssdServiceProvider" -``` - -This is the contents of the published config file: - -```php -return [ - 'provider' => env('USSD_PROVIDER', 'korba') -]; -``` - -**Update your `.env` file with the USSD provider key value pair** -```bash -USSD_PROVIDER= -``` - -Supported USSD providers [Ghana]: -* [korba](http://korbaweb.com) -* [hubtel](https://developers.hubtel.com/docs/getting-started-with-ussd) -* [nsano](https://www.nsano.com) -* [txtghana](https://www.txtghana.com) - ## Usage -**Create USSD Controller** -```bash -php artisan ussd:controller filename -``` - -**Create USSD Migration** -```bash -php artisan ussd:migration tablename -``` - -**Create USSD Model** -```bash -php artisan ussd:model classname -``` - -**Create USSD List View** -```bash -php artisan ussd:view-list filename -``` - -**Create USSD Simple View** -```bash -php artisan ussd:view-simple filename -``` - -**Create USSD Titled View** -```bash -php artisan ussd:view-titled filename -``` - ## Change log Please see the [changelog](changelog.md) for more information on what has changed recently. @@ -93,22 +38,20 @@ If you discover any security related issues, please email isaacsai030@gmail.com ## Credits - [Isaac Adzah Sai][link-author] -- [Benjamin Manford][link-author2] - [All Contributors][link-contributors] ## License MIT. Please see the [license file](license.md) for more information. -[ico-version]: https://img.shields.io/packagist/v/cybersai/laravel-ussd.svg?style=flat-square -[ico-downloads]: https://img.shields.io/packagist/dt/cybersai/laravel-ussd.svg?style=flat-square -[ico-travis]: https://img.shields.io/travis/cybersai/laravel-ussd/master.svg?style=flat-square +[ico-version]: https://img.shields.io/packagist/v/cybersai/laravelussd.svg?style=flat-square +[ico-downloads]: https://img.shields.io/packagist/dt/cybersai/laravelussd.svg?style=flat-square +[ico-travis]: https://img.shields.io/travis/cybersai/laravelussd/master.svg?style=flat-square [ico-styleci]: https://styleci.io/repos/12345678/shield -[link-packagist]: https://packagist.org/packages/cybersai/laravel-ussd -[link-downloads]: https://packagist.org/packages/cybersai/laravel-ussd -[link-travis]: https://travis-ci.org/cybersai/laravel-ussd +[link-packagist]: https://packagist.org/packages/cybersai/laravelussd +[link-downloads]: https://packagist.org/packages/cybersai/laravelussd +[link-travis]: https://travis-ci.org/cybersai/laravelussd [link-styleci]: https://styleci.io/repos/12345678 [link-author]: https://github.com/cybersai -[link-author2]: https://github.com/manfordbenjamin -[link-contributors]: https://github.com/CyberSai/laravel-ussd/graphs/contributors +[link-contributors]: ../../contributors diff --git a/src/Console/Commands/CreateController.php b/src/Console/Commands/CreateController.php index f1e45c3..76e9c9a 100644 --- a/src/Console/Commands/CreateController.php +++ b/src/Console/Commands/CreateController.php @@ -1,10 +1,9 @@ app->runningInConsole()) - { - $this->publishes([ - __DIR__ . '/../config/ussd.php' => config_path('ussd.php'), - ]); - - $this->commands([ - CreateMigration::class, - CreateModel::class, - CreateSimpleView::class, - CreateTitledView::class, - CreateListView::class, - CreateController::class, - CreateViewGroup::class, - CreateViewValidator::class - ]); + // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'cybersai'); + // $this->loadViewsFrom(__DIR__.'/../resources/views', 'cybersai'); + // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); + // $this->loadRoutesFrom(__DIR__.'/routes.php'); + + // Publishing is only necessary when using the CLI. + if ($this->app->runningInConsole()) { + $this->bootForConsole(); } } /** - * Register the application services. + * Register any package services. + * + * @return void */ public function register() { - $this->mergeConfigFrom(__DIR__ . '/../config/ussd.php', 'config'); + $this->mergeConfigFrom(__DIR__ . '/../config/ussd.php', 'laravelussd'); + + // Register the service the package provides. + $this->app->singleton('laravelussd', function ($app) { + return new Ussd; + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['laravelussd']; + } + + /** + * Console-specific booting. + * + * @return void + */ + protected function bootForConsole() + { + // Publishing the configuration file. + $this->publishes([ + __DIR__ . '/../config/ussd.php' => config_path('ussd.php'), + ], 'laravelussd.config'); + + // Publishing the views. + /*$this->publishes([ + __DIR__.'/../resources/views' => base_path('resources/views/vendor/cybersai'), + ], 'laravelussd.views');*/ + + // Publishing assets. + /*$this->publishes([ + __DIR__.'/../resources/assets' => public_path('vendor/cybersai'), + ], 'laravelussd.views');*/ + + // Publishing the translation files. + /*$this->publishes([ + __DIR__.'/../resources/lang' => resource_path('lang/vendor/cybersai'), + ], 'laravelussd.views');*/ + + // Registering package commands. + $this->commands([ + CreateController::class, + CreateListView::class, + CreateMigration::class, + CreateModel::class, + CreateSimpleView::class, + CreateTitledView::class, + CreateViewGroup::class, + CreateViewValidator::class + ]); } }