Adds support for SQLite3 storage in your application.
# create an example application
composer require phpolar/sqlite-storage- Keep project small. See thresholds
- Automatically load and persist data
Note For more details see the acceptance tests results
$sqliteStorage = new SqliteStorage(
connection: $connection,
tableName: "table_name",
typeClassName: Person::class,
);
$sqliteStorage->save($item1->id, $item);
$sqliteStorage->replace($updatedItem->id, $updatedItem);
$sqliteStorage->remove($item2->id);
$item3 = $sqliteStorage->find("id3")
->orElse(static fn() => new NotFound())
->tryUnwrap();
$allItems = $sqliteStorage->findAll();use Phpolar\Phpolar\AbstractModel;
class Person extends AbstractModel
{
#[PrimaryKey]
#[Hidden]
public string $id;
public string $firstName;
public string $lastName;
public string $address1;
public string $address2;
public function getPrimaryKey(): string
{
return $id;
}
}| Module | Source Code Size * | Memory Usage | Required |
|---|---|---|---|
| phpolar/sqlite-storage | 9 kB | 150 kB | x |
- Note: Does not include comments.