PHP code example of formal / access-layer
1. Go to this page and download the library: Download formal/access-layer 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/ */
formal / access-layer example snippets
use Formal\AccessLayer\{
Connection\Lazy,
Connection\PDO,
Query\SQL,
Row,
};
use Innmind\Url\Url;
use Innmind\Immutable\Sequence;
$connection = Lazy::of(static fn() => PDO::of(Url::of('mysql://user:[email protected]:3306/database_name')));
$rows = $connection(SQL::of('SELECT * FROM `some_table`'));
$rows; // instanceof Sequence<Row>