PHP code example of xrobau / laravel-sql-storage
1. Go to this page and download the library: Download xrobau/laravel-sql-storage 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/ */
xrobau / laravel-sql-storage example snippets
// Everything is related to an individual uuid. Think of this as
// the base folder.
$uuid = 'a3b04866-99b4-4edd-a85f-b12727bdd2ca';
// The @var is just an IDE Hint
/** @var SqlStorageDriver $s */
$s = Storage::disk('database');
// If you don't set 'usingUuid' it'll throw.
$s->usingUuid($uuid);
// This is the filename you want to mess with
$filename = "this.is.fake.txt";
// Set it to some random contents
$contents = str_repeat(str_repeat("a", 100) . str_repeat("b", 100), 100);
$s->put($filename, $contents);
// Now you can test it
if (!$s->exists($filename)) {
print "$filename does not exist?\n";
exit;
};
$out = $s->get($filename);
if ($out !== $contents) {
print "Output didn't match what was put in?\nOut: '$out'\nOrig: '$contents'\n";
exit;
}
print "Size is " . $s->size($filename) . "\n";
$m = $s->getModel($filename);
print "Model is: " . json_encode($m) . "\n";
$s->delete($filename);