dlepera88-php / doctrine-prefixes
Set database and/or table prefix.
Installs: 61
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/dlepera88-php/doctrine-prefixes
Requires
- php: >=7.0
- doctrine/event-manager: ^1.1
- doctrine/orm: ^2.6
Requires (Dev)
- phpunit/phpunit: ^8.4
This package is auto-updated.
Last update: 2025-09-18 07:36:27 UTC
README
In some cases, we need to install a web application on shared hosts. On shared hosts, database names usually have a prefix, like cPanel, for example. Eg: etc_dbname.
So, I make this package. I hope this help u.
Basic Usage
<?php // $connectionOptions and $config set earlier /** @var $connectionOptions */ /** @var array $config */ $evm = new \Doctrine\Common\EventManager; // Database Prefix $database_prefix = new \DoctrinePrefixes\DatabasePrefix('db_'); $evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $database_prefix); // Table Prefix $table_prefix = new \DoctrinePrefixes\TablePrefix('prefix_'); $evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $table_prefix); $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $evm);