From 5cad6b468d17a9f6301afabbc4727cfeada416e9 Mon Sep 17 00:00:00 2001 From: myckhel Date: Thu, 15 Oct 2020 19:30:40 +0100 Subject: [PATCH] created doc --- readme.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index f692553..d21da14 100644 --- a/readme.md +++ b/readme.md @@ -9,37 +9,100 @@ ## Install Via Composer -`$ composer require myckhel/laravel-iaphub` +```bash +composer require myckhel/laravel-iaphub +``` ## Setup The package will automatically register a service provider. You need to publish the configuration file: -```php artisan vendor:publish --provider="Myckhel\Iaphub\IaphubServiceProvider"``` - -This is the default content of the config file ```Iaphub.php```: - -``` env("IAPHUB_API_KEY"), + "app_id" => env("IAPHUB_APP_ID"), + "env" => env("IAPHUB_APP_ENV"), + "hook_token" => env("IAPHUB_HOOK_TOKEN"), + // this middleware will be used for IAPHUB routes + "route_middleware" => 'iaphub_disabled', // comma separated values e.g 'auth:api,auth:web' + ]; ``` Update Your Projects `.env` with: ``` - +IAPHUB_API_KEY=EaYYAcOugVK9BccHphIStamqLQkh2Xi +IAPHUB_APP_ID=5f8823fe9856f60e35712a03 +IAPHUB_HOOK_TOKEN=cLFh3Zgg2cWQDAIiZCUzqmAquDvHWr +IAPHUB_APP_ENV=development ``` Run the database migration -`php artisan migrate` +```bash +php artisan migrate +``` ## Available Api's -``` +```php +all()); + } +} +``` + +## Middleware +IAPHUB provided 2 middlewares +### `iaphub_hook_token` +For authenticating iaphub hook request +#### Example: +```php +middleware('iaphub_hook_token'); + +``` +### `iaphub_disabled` +For disabling route request +returns 403 response +#### Example: +```php +middleware('iaphub_disabled'); +/* returns { + "message": "This Endpoint Is Disabled \n enable it by replacing the 'iaphub_disabled' middleware from your config", + } +*/ + +``` ## Todos