Skip to content

PlasmaPHP/core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plasma Build Status Build Status Code Coverage

Plasma provides an asynchronous, non-blocking (data access) Database Abstraction Layer. This is the core component, defining common parts and interfaces.

The core component alone does nothing, you need a Plasma driver, which does all the handling of the DBMS.

Plasma does not aim to be a full Database Abstraction Layer. Simulating missing features is not a goal and should never be.

For a list of drivers, see the main repository.

Getting Started

As soon as you have selected a driver, you can install it using composer. For the core, the command is

composer require plasma/core 

Each driver has their own dependencies, as such they have to implement a factory, which creates their driver instances correctly. For more information, see the driver project page.

But this is some little pseudo code:

$loop = \React\EventLoop\Factory::create(); $factory = new \SomeGuy\PlasmaDriver\MsSQLFactory($loop); $client = \Plasma\Client::create($factory, 'root:1234@localhost'); $client->execute('SELECT * FROM `users`', []) ->then(function (\Plasma\QueryResultInterface $result) use ($client) { // Do something with the query result // Most likely for a SELECT query, // it will be a streaming query result $client->close()->done(); }, function (\Throwable $error) use ($client) { // Oh no, an error occurred! echo $error.\PHP_EOL; $client->close()->done(); }); $loop->run();

Documentation

https://plasmaphp.github.io/core/