1. Go to this page and download the library: Download esd/postgresql-plugin 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/ */
esd / postgresql-plugin example snippets
namespace app;
use ESD\Go\GoApplication;
use ESD\Plugins\Postgresql\PostgresqlPlugin;
class Application
{
/**
* @throws \DI\DependencyException
* @throws \DI\NotFoundException
* @throws \ESD\Core\Exception
* @throws \ESD\Core\Plugins\Config\ConfigException
* @throws \ReflectionException
*/
public static function main()
{
$application = new GoApplication();
$application->addPlug(new PostgresqlPlugin());
$application->run();
}
}
use GetPostgresql;
public function test()
{
$this->postgresql()->query("select * from pg_stat_activity");
return $res;
}
public function test()
{
$this->postgresql('test')->query("select * from pg_stat_activity");
return $res;
}
use DI\Annotation\Inject;
/**
* @Inject()
* @var \ESD\Plugins\Postgresql\PostgresDb
*/
protected $postgresql;
public function test(){
$res = $this->postgresql->query("select * from pg_stat_activity");
return $res;
}