PHP code example of aliirfaan / citronel-external-service-generator
1. Go to this page and download the library: Download aliirfaan/citronel-external-service-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aliirfaan / citronel-external-service-generator example snippets
return [
'web_service' => [
'base_url' => env('HTTP_BIN_PLATFORM_BASE_URL'),
'connect_timeout_seconds' => env('HTTP_BIN_PLATFORM_CONNECT_TIMEOUT_SECONDS', 10),
'timeout_seconds' => env('HTTP_BIN_PLATFORM_TIMEOUT_SECONDS', 60),
'username' => env('HTTP_BIN_PLATFORM_USERNAME'),
'password' => env('HTTP_BIN_PLATFORM_PASSWORD'),
'api_key' => env('HTTP_BIN_PLATFORM_KEY'),
'endpoints' => [
'ip_endpoint' => [
'api_operation' => 'ip',
'endpoint' => '/example-endpoint',
'method' => 'GET',
'logging' => [ // this will override the global logging settings and can be omitted if not needed
'should_log' => env('HTTP_BIN_PLATFORM_SHOULD_LOG'),
'requests' => [
'should_log' => env('HTTP_BIN_PLATFORM_SHOULD_LOG_REQUESTS'),
],
'responses' => [
'should_log' => env('HTTP_BIN_PLATFORM_SHOULD_LOG_RESPONSES'),
'log_channel' => env('HTTP_BIN_PLATFORM_LOG_RESPONSE_CHANNEL'),
]
],
'caching' => [
'should_cache' => env('HTTP_BIN_PLATFORM_SHOULD_CACHE'),
'cache_key' => 'HTTP_BIN_PLATFORM_example',
'cache_seconds' => env('HTTP_BIN_PLATFORM_CACHE_EXAMPLE_ENDPOINT_SEC', 3600),
]
]
],
],
'logging' => [
'should_log' => env('HTTP_BIN_PLATFORM_SHOULD_LOG', false),
'requests' => [
'should_log' => env('HTTP_BIN_PLATFORM_SHOULD_LOG_REQUESTS', true),
'event_class' => env('HTTP_BIN_PLATFORM_LOG_REQUEST_EVENT_CLASS', App\Events\Test::class),
'model' => env('HTTP_BIN_PLATFORM_LOG_REQUEST_MODEL', App\Models\Request::class),
],
'responses' => [
'should_log' => env('HTTP_BIN_PLATFORM_SHOULD_LOG_RESPONSES', true),
'event_class' => env('HTTP_BIN_PLATFORM_LOG_RESPONSE_EVENT_CLASS', App\Events\Test::class),
'model' => env('HTTP_BIN_PLATFORM_LOG_RESPONSE_MODEL', App\Models\Response::class),
'log_response_channel' => env('HTTP_BIN_PLATFORM_LOG_RESPONSE_CHANNEL', 'HTTP_BIN_PLATFORM_response', null),
],
],
'caching' => [
'should_cache' => env('HTTP_BIN_PLATFORM_SHOULD_CACHE', false),
],
'pruning' => [
'should_prune' => env('HTTP_BIN_PLATFORM_SHOULD_PRUNE', true),
'requests' => [
'should_prune' => env('HTTP_BIN_PLATFORM_SHOULD_PRUNE_REQUESTS', true),
'prune_days' => env('HTTP_BIN_PLATFORM_PRUNE_REQUESTS_DAYS', 60),
],
'responses' => [
'should_prune' => env('HTTP_BIN_PLATFORM_SHOULD_PRUNE_RESPONSES', true),
'prune_days' => env('HTTP_BIN_PLATFORM_PRUNE_RESPONSES_DAYS', 60),
]
]
];
bash
$ php artisan migrate
bash
$ php artisan citronel:external-service-generate:event HttpBinPlatform/HttpBinPlatformRequestSent
bash
$ php artisan citronel:external-service-generate:event HttpBinPlatform/HttpBinPlatformResponseReceived