1. Go to this page and download the library: Download xoops/helpers 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/ */
// XMF 1.x — before
if (!$data = \XoopsCache::read("{$dirname}_config")) {
$data = xoops_getModuleConfig($dirname);
\XoopsCache::write("{$dirname}_config", $data);
}
// XOOPS Helpers — after
$data = Cache::remember("{$dirname}_config", 3600, fn() => xoops_getModuleConfig($dirname));
use Xoops\Helpers\Service\{Path, Url, Config, Cache};
use Xoops\Helpers\Provider\ArrayCache;
// Inject test implementations
Cache::use(new ArrayCache());
Config::registerLoader('mymod', fn() => ['key' => 'value']);
// Reset after tests
Cache::reset();
Config::reset();
Path::reset();
Url::reset();
use Xoops\Helpers\Utility\Date;
use Xoops\Helpers\Contracts\DateTimeProviderInterface;
Date::setProvider(new class implements DateTimeProviderInterface {
public function now(): \DateTimeImmutable {
return new \DateTimeImmutable('2025-06-15 12:00:00');
}
});
Date::isToday('2025-06-15'); // true — deterministic in tests
Date::resetProvider();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.