PHP code example of uak35 / laravel-weighted-dbmanager
1. Go to this page and download the library: Download uak35/laravel-weighted-dbmanager 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/ */
uak35 / laravel-weighted-dbmanager example snippets
config('app.providers') ?? ServiceProvider::defaultProviders()->toArray()
// … and only then appends whatever bootstrap/providers.php returns
'pgcat' => [
// No (bool) here on purpose: a cast reads 'off' as on, so `enabled` and
// `allow_local_fallback` hand over the value as written and let the package
// read it — see "Switches are read, not cast" above.
'enabled' => env('SWRR_PGCAT_ENABLED', false),
'config_path' => env('SWRR_PGCAT_CONFIG', '/etc/pgcat/pgcat.toml'),
'readers_path' => env('SWRR_PGCAT_READERS', '/etc/pgcat/pgcat-readers.toml'),
'no_readers_path' => env('SWRR_PGCAT_NO_READERS', '/etc/pgcat/pgcat-no-readers.toml'),
'restart_command' => 'supervisorctl restart "pgcat:*"',
'reload_command' => 'supervisorctl signal HUP "pgcat:*"',
'use_reload' => true,
'state_file' => sys_get_temp_dir().'/pgcat-flip-state.json',
'lock_file' => sys_get_temp_dir().'/pgcat-flip.lock',
],
$manager->setAllowLocalFallback(false);
use Uak35\WeightedDbManager\Http\Controllers\DatabaseHealthController;
Route::get('/health/db', [DatabaseHealthController::class, 'index'])
->middleware('auth.basic');