Skip to content

Latest commit

 

History

History
executable file
·
26 lines (21 loc) · 665 Bytes

Database.md

File metadata and controls

executable file
·
26 lines (21 loc) · 665 Bytes

Database

You can connect to a database and send queries with DatabaseInterface.

Note

Currently only the Mysql driver is supported.

You will need to define a connection string in your environment variables (env.ini).

interface = 127.0.0.1:5757
staticsLocation = statics
apiLocation = src/api
mysql="host=localhost user=root password=root db=test"
// src/api/{email}/get.php
use CatPaw\Database\Interfaces\DatabaseInterface;

return fn (DatabaseInterface $db, string $email) => $db->send(
   <<<SQL
       select email, name from users where email = :email
       SQL,
   ['email' => $email]
);