Hi,
I would like to propose a new PSR standardizing how PDO connections are
provided between libraries.
The problem has two sides. First, passing a \PDO instance directly
surrenders control over the connection lifecycle: the caller loses the
ability to control when and how the connection is opened, verified, or
recreated. Second, there is no standardized contract for passing a
connection between libraries. Widely-used libraries such as doctrine/dbal,
illuminate/database, nette/database, and cakephp/database each wrap PDO in
their own connection object, with no common interface.
The proposed interface is intentionally minimal, modeled after PSR-20's
ClockInterface:
==========
namespace Psr\Pdo;
interface PdoProviderInterface
{
public function getConnection(): \PDO;
}
==========
Draft PR: https://github.com/php-fig/fig-standards/pull/1348
Background:
https://maximegosselin.com/posts/proposing-a-psr-for-pdo-providers/
I intend to reach out to the Doctrine DBAL maintainers in the near future
to gauge their interest.
I am looking for a sponsor and working group members.
Regards,
Maxime Gosselin
--
You received this message because you are subscribed to the Google Groups "PHP
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/php-fig/3851efd5-d746-483f-b47a-f741c9eee27an%40googlegroups.com.