Initial Commit with ENVs, directory structures, cursor rules, etc
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
function readJsonFile($filename) {
|
||||
$filepath = __DIR__ . '/../data/' . $filename;
|
||||
if (!file_exists($filepath)) {
|
||||
return [];
|
||||
}
|
||||
$content = file_get_contents($filepath);
|
||||
return json_decode($content, true) ?? [];
|
||||
}
|
||||
|
||||
function writeJsonFile($filename, $data) {
|
||||
$filepath = __DIR__ . '/../data/' . $filename;
|
||||
$json = json_encode($data, JSON_PRETTY_PRINT);
|
||||
return file_put_contents($filepath, $json);
|
||||
}
|
||||
|
||||
function ensureDataDirectory() {
|
||||
$dataDir = __DIR__ . '/../data';
|
||||
if (!file_exists($dataDir)) {
|
||||
mkdir($dataDir, 0755, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user