1. Go to this page and download the library: Download oksydan/falconize 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/ */
oksydan / falconize example snippets
namespace MyModule\NamespaceName;
use Doctrine\DBAL\Connection;
use Oksydan\Falconize\FalconizeConfigurationInterface;
use Oksydan\Falconize\PrestaShop\Module\PrestaShopModuleInterface;
final class FalconizeConfiguration implements FalconizeConfigurationInterface
{
protected PrestaShopModuleInterface $module;
protected Connection $connection;
protected string $databasePrefix;
protected string $prestashopVersion;
public function __construct(
PrestaShopModuleInterface $module,
Connection $connection,
string $databasePrefix,
string $prestashopVersion
) {
$this->module = $module;
$this->connection = $connection;
$this->databasePrefix = $databasePrefix;
$this->prestashopVersion = $prestashopVersion;
}
public function getConnection(): Connection
{
return $this->connection;
}
public function getModule(): PrestaShopModuleInterface
{
return $this->module;
}
public function getConfigurationFile(): \SplFileInfo
{
// /../../config/configuration.yml is just an example path to configuration file
return new \SplFileInfo(__DIR__ . '/../../config/configuration.yml');
}
public function getDatabasePrefix(): string
{
return $this->databasePrefix;
}
public function getPrestashopVersion(): string
{
return $this->prestashopVersion;
}
}
use Oksydan\Falconize\Falconize;
use MyModule\NamespaceName\FalconizeConfiguration;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
use Oksydan\Falconize\PrestaShop\Module\PrestaShopModuleInterface;
class MyModule extends Module implements PrestaShopModuleInterface
{
protected Falconize $falconize;
public function __construct()
{
...
}
private function getFalconize()
{
if (!isset($this->falconize)) {
$falconizeConfiguration = new FalconizeConfiguration(
$this,
SymfonyContainer::getInstance()->get('doctrine.dbal.default_connection'),
_DB_PREFIX_,
_PS_VERSION_
);
$this->falconize = new Falconize($falconizeConfiguration);
}
return $this->falconize;
}
}
...
class MyModule extends Module implements PrestaShopModuleInterface
{
...
public function install()
{
return parent::install() &&
$this->getFalconize()->install();
}
public function uninstall()
{
return parent::uninstall() &&
$this->getFalconize()->uninstall();
}
}
function upgrade_module_1_1_0($module) // 1.1.0 is example version
{
return $module->getFalconize()->install();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.