1. Go to this page and download the library: Download micoli/elql 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/ */
micoli / elql example snippets
$database = new Elql(
new FilePersister(
'/var/lib/database',
new MetadataManager(),
YamlEncoder::FORMAT,
),
);
$database->add(
new Baz(1, 'a', 'a'),
new Baz(2, 'b', 'b'),
new Baz(3, 'c', 'c'),
new Baz(4, 'd', 'd'),
new Foo(1, 'aa', new DateTimeImmutable()),
);
$database->delete(Baz::class, 'record.id in [1,4]');
print $database->count(Baz::class, 'record.id in [1,4]');
$database->persister->flush();
#[Table('b_a_z')]
class Baz
{
public function __construct(
public readonly int $id,
public string $firstName,
public string $lastName,
) {
}
}
$database = new Elql(
new FilePersister(
'/var/lib/database',
new MetadataManager([
Foo::class=>'foo_table'
]),
YamlEncoder::FORMAT,
),
);
#[Unique('record.id')]
#[Unique('[record.firstName,record.lastName]', 'fullname')]
class Baz
{
public function __construct(
public readonly int $id,
public string $firstName,
public string $lastName,
) {
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.