1. Go to this page and download the library: Download phariscope/multitenant 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/ */
class YourController extends AbstractController
{
public function __construct(
private EntityManagerResolver $entityManagerResolver,
) {}
#[Route('your/route', name: 'runYourRoute', methods: ['POST', 'GET'])]
public function runYourRoute(Request $request): Response
{
$tenantEntityManager = $this->entityManagerResolver->getEntityManagerByRequest($request);
(new DatabaseTools())->createDatabaseIfNotExists($entityManager);
$repository = new YourSomeEntityDoctrineRepository($tenantEntityManager);
// Your code here...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.