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
Cheers
--
Matteo
--
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 php-fig+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/22158d81-f778-4a2f-a119-fec5b136e492%40beccati.com.
--
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 php-fig+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/ff37ac84-abf1-4f1d-875e-eb8b7d858c5e%40app.fastmail.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/CAPhJx--TNnaJY_dYnFKtbf%2BtUu8d%3Dhj83bHLTv-JHX_ZB90ATg%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/CAB%2BY%2BEreK3zuLBpFb5x8vc1Jn86EdgzZNpNuPEoXWxFTd_2hKg%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/0002e1da-62de-49eb-9a7a-c5d7b0932d1bn%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/CAB%2BY%2BEp0W3z7r_GB2d-3kKgn7XHf3uyF92ADXk2wF9%2BgV4-2DQ%40mail.gmail.com.