1. Go to this page and download the library: Download arkonsoft/ps-module-core 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/ */
arkonsoft / ps-module-core example snippets
if (!defined('_PS_VERSION_')) {
exit;
}
use Arkonsoft\PsModule\Core\Module\AbstractModule;
class MyModule extends AbstractModule
{
public function __construct()
{
$this->name = 'mymodule';
// ps-module-core
$this->tab = ModuleCategory::FRONT_OFFICE_FEATURES;
$this->version = '1.0.0';
$this->author = 'Firstname Lastname';
$this->need_instance = 0;
$this->ps_versions_compliancy = [
'min' => '1.7.0.0',
'max' => '8.99.99',
];
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->trans('My module', [], 'Modules.Mymodule.Admin');
$this->description = $this->trans('Description of my module.', [], 'Modules.Mymodule.Admin');
$this->confirmUninstall = $this->trans('Are you sure you want to uninstall?', [], 'Modules.Mymodule.Admin');
// ps-module-core
if ($this->canBeUpgraded()) {
$this->warning = $this->trans('The module %s needs to be updated. Use the "update" option in the list of modules. The module without an update may not work properly.', [ $this->name ], 'Modules.Mymodule.Admin');
}
}
}
/**
* Returns the database version of the module
*
* @return ?string
*/
protected function getDatabaseVersion()
/**
* Checks if the database version is lower than the specified version for potential upgrade.
*
* @return bool
*/
protected function canBeUpgraded(): bool
public function __construct()
{
// other code
if ($this->canBeUpgraded()) {
$this->warning = $this->trans('The module %s needs to be updated. Use the "update" option in the list of modules. The module without an update may not work properly.', [ $this->name ], 'Modules.Mymodule.Admin');
}
}
public function __construct()
{
// other code
$this->tab = ModuleCategory::FRONT_OFFICE_FEATURES;
}
public function installTab(): bool
{
if (Tab::getIdFromClassName($this->settingsAdminController)) {
return true;
}
$tab = new Tab();
$parentTabClassName = TabDictionary::CATALOG;
// other code
}
public function __construct()
abstract public function prepareOptions();
public function initContent()
public function postProcess()
public function dispatchAction()
public function renderForm()
public function loadFormValues(HelperForm $helper)
public function saveForm()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.