-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed.php
More file actions
34 lines (27 loc) · 757 Bytes
/
seed.php
File metadata and controls
34 lines (27 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env php
<?php
require 'vendor/autoload.php';
use WessamA\BinLookup\ConfigLoader;
use WessamA\BinLookup\Database\Seeder\BanksTableSeeder;
use WessamA\BinLookup\Database\SQLiteManager;
// Load environment variables
$config = new ConfigLoader;
// Initialize the BankLogoService
try {
$dbManager = new SQLiteManager($config->getConfig());
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage() . "\n";
exit(1);
}
$bankSeeder = new BanksTableSeeder($dbManager);
// Check CLI arguments
$command = $argv[1] ?? null;
switch ($command) {
case 'run':
$bankSeeder->seedFromJsonFile();
echo "Seeding completed successfully.\n";
break;
default:
echo "Usage: php seed.php run\n";
break;
}