Download the PHP package xoops/helpers without Composer

On this page you can find all versions of the php package xoops/helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package helpers

XOOPS Helpers

Convention-over-configuration utility and service helpers for XOOPS CMS development.

License: GPL v2 PHP 8.2+

41 source files. 151 tests. Zero configuration. XSS-safe HTML by default. One composer require.

What Is This?

XOOPS Helpers is a standalone utility library that makes every XOOPS module safer and shorter by replacing the repetitive, error-prone boilerplate every module developer writes over and over:

That first line is not just shorter — it is structurally safer. Every manual htmlspecialchars() call is a place where a future developer can introduce a stored XSS vulnerability by forgetting it once. HtmlBuilder escapes all attribute values and class names automatically — the source of the vast majority of real-world XSS. Tag content is your responsibility, intentionally: content can legitimately contain HTML (rendered markup, trusted template fragments). The safe path is explicit: pass user-supplied content through HtmlBuilder::escape(). This htmlspecialchars pattern appears 30+ times in the XOOPS Core alone — each one a place where this library makes the correct choice the easiest choice.

Requirements

Optional extensions for enhanced functionality:

Installation

Quick Start

Library Contents

Tier 0 — Utility (Pure PHP, zero XOOPS dependency)

These work anywhere — CLI scripts, cron jobs, unit tests — no XOOPS boot required.

Class Purpose
HtmlBuilder XSS-safe HTML: attributes, classes, tag, escape, text, stylesheet, script, meta — attribute values escaped automatically; use text() to explicitly escape tag content
Arr Array helpers with dot notation: get, set, has, pluck, groupBy, sortBy, where, flatten, dot/undot, only/except, first/last, wrap, collapse
Str String helpers: slug, camel/snake/studly/kebab, limit, random, contains/startsWith/endsWith, between, mask, isEmail/isUrl/isIp/isJson/isHexColor
Number Number formatting: format, fileSize, forHumans, percentage, ordinal, currency, clamp
Date Date helpers with injectable time source: now, range, diff, isValid, addDays/subDays, isWeekend/isToday/isPast/isFuture, reformat, age
Value Value resolution: value (Closure resolver), blank/filled, optional (null-safe access), once (memoization), missing (sentinel)
Collection Fluent array wrapper: map, filter, reject, reduce, pluck, groupBy, sortBy, first/last, chunk, take/skip, sum/avg/min/max, when, pipe, tap
Pipeline Data transformation chains: Pipeline::send($v)->pipe(fn)->pipe(fn)->thenReturn()
Stringable Fluent string builder: Stringable::of($s)->trim()->lower()->slug()->toString()
Filesystem File operations: readJson/putJson, mimeType, isImage, mkdir, deleteDirectory, copyDirectory, zip/unzip, readChunked
Environment Runtime detection: isProduction/isDevelopment/isTesting, get/require/has
Benchmark Profiling: measure (time + memory), time, average (multi-iteration)
Encoding URL-safe base64: base64UrlEncode/base64UrlDecode
Data Conversion: toArray, toObject, toQueryString, fromQueryString
Retry Error recovery: retry (with backoff), rescue (with fallback)
ThrowHelper Guard clauses: throwIf, throwUnless
Transform Conditional transforms: transform (if filled), when (predicate-based)
Tap Side-effect helper: call callback, return original value

Tier 1 — Contracts (Interfaces)

Interface Purpose
PathLocatorInterface Filesystem path resolution
UrlGeneratorInterface URL generation
CacheInterface Cache operations
ConfigProviderInterface Configuration loading
DateTimeProviderInterface Clock abstraction for testing

Tier 2 — Service Facades (Zero-config, XOOPS-aware)

Facade Purpose Override
Path Path::base(), module(), storage(), uploads(), themes(), languageFile() Path::use($locator)
Url Url::to(), asset(), module(), theme() Url::use($generator)
Config Config::get(), set(), has(), all(), registerLoader() Config::setProvider($p)
Cache Cache::get(), set(), forget(), remember(), flush() Cache::use($adapter)

All facades work immediately using XOOPS constants (XOOPS_ROOT_PATH, XOOPS_URL, etc.). Override with ::use() for testing or custom installations. Reset with ::reset().

Tier 3 — Providers (Default implementations)

Provider Purpose
DefaultPathLocator Maps to XOOPS constants
DefaultUrlGenerator Uses XOOPS_URL, falls back to $_SERVER
XoopsCacheAdapter Auto-detects: XoopsCache, APCu, or file cache
ArrayCache In-memory cache for testing
SystemDateTimeProvider System clock

Tier 4 — Integration (XOOPS-specific)

Component Purpose
XoopsCollection XoopsCollection::fromHandler($handler, $criteria) with pluckVar() for getVar()
AssetUrlPlugin Smarty: <{asset_url path="css/style.css"}>
FormatNumberPlugin Smarty: <{format_number value=$size type="filesize"}>
CssClassesPlugin Smarty: <{css_classes classes=$classArray}>
PluginRegistrar Register all Smarty plugins at once

Cross-cutting

Component Purpose
Tappable Trait adding tap() to any class
functions.php Optional global function wrappers (not auto-loaded)

Architecture

Dependencies flow downward only. Tier 0 classes can be used in any PHP 8.2+ project without XOOPS — in CLI scripts, cron jobs, and unit tests with no bootstrap required.

Optional Global Functions

The file src/functions.php provides short function wrappers like collect(), str(), pipeline(), tap(), retry(), env(), etc. It is not auto-loaded — opt in explicitly.

Recommended pattern: load it once in your XOOPS bootstrap, not in individual module files. This prevents redundant require calls across a multi-module installation:

If you are building a single module and do not control the bootstrap, load it in your module's entry point:

All functions are guarded with function_exists() to prevent fatal redeclaration errors.

Compatibility

XOOPS 2.5.x

Fully compatible. Designed for inclusion in XOOPS 2.5.12+.

XMF 1.x (xoops/xmf)

No conflicts. Different namespace (Xoops\Helpers\ vs Xmf\), no shared class names, no shared global functions. Both can be loaded simultaneously via Composer.

Where both libraries offer related functionality, they serve different scopes:

Area XMF 1.x XOOPS Helpers
URL/Path $helper->url() — module-scoped Url::module() — global, works without module context
Config $helper->getConfig() — per-module handler Config::get('mod.key') — dot notation, cached
Cache Helper\Cache::cacheRead() — module-prefixed Cache::remember() — global, auto-backend
Random Random::generateKey() — SHA512 hash tokens Str::random() — URL-safe strings, configurable length
SEO Metagen::generateSeoTitle() — full meta tags Str::slug() — pure string transformation

Migration Strategy

You do not need to refactor existing XMF 1.x code to adopt this library. Both coexist safely. The recommended approach depends on where you are in a project:

Starting a new module — use XOOPS Helpers exclusively from the first line. There is no legacy to consider and you get the full benefit of automatic escaping, dot-notation config, and fluent collections from day one.

Actively developing an existing module — use XOOPS Helpers for all new code and any functions you touch during the current sprint. When you open a file to add a feature, convert the XMF 1.x patterns in that file as you go. Do not schedule a dedicated refactoring sprint; let the migration happen organically as the module evolves.

Maintaining a stable module with no active development — do nothing. The libraries coexist with zero conflicts. The migration cost is not justified by a pure maintenance ticket. If it is not broken, leave it until you have a reason to open the file.

When you do migrate a specific pattern, the Cache facade is the most common conversion:

XMF 2.0 (xoops/xmf next generation)

Designed as a companion. XMF 2.0 provides the architectural framework (Repository, EventBus, Container, QueryBuilder); XOOPS Helpers provides the day-to-day utilities (Arr, Str, Number, HtmlBuilder, Collection). XMF 2.0 will declare xoops/helpers as a dependency — requiring XMF 2.0 pulls this library in automatically.

Testing

All services are mockable for testing:

The Date utility accepts an injectable time provider:

Contributing

Contributions are welcome. Please follow XOOPS coding standards:

Documentation

See TUTORIAL.md for a comprehensive guide with before/after comparisons from real XOOPS Core and module code.

License

LICENSE for details.


All versions of helpers with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xoops/helpers contains the following files

Loading the files please wait ...