PHPackages                             imponeer/smarty-xo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. imponeer/smarty-xo

ActiveLibrary[Templating &amp; Views](/categories/templating)

imponeer/smarty-xo
==================

Smarty template engine plugins collections based on ideas for plugins from XOOPS

v1.1.8(3y ago)120.8k↓73.3%1[1 PRs](https://github.com/imponeer/smarty-xo/pulls)MITPHPPHP &gt;=7.1CI passing

Since Feb 7Pushed 3d ago2 watchersCompare

[ Source](https://github.com/imponeer/smarty-xo)[ Packagist](https://packagist.org/packages/imponeer/smarty-xo)[ RSS](/packages/imponeer-smarty-xo/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (1)Versions (17)Used By (0)

[![License](https://camo.githubusercontent.com/71156e02ad7f5fb137506f5c3b8f2304fabf3ea9cd5bc5471745733cb10d6937/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d706f6e6565722f736d617274792d786f2e737667)](LICENSE)[![GitHub release](https://camo.githubusercontent.com/a5531a11003469cf4568ffeb336820a510b412ff81736e2029cc7721f0f8109e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f696d706f6e6565722f736d617274792d786f2e737667)](https://github.com/imponeer/smarty-xo/releases) [![PHP](https://camo.githubusercontent.com/111d38edf5247dc2a12f41e60e3f680048a34f0b6e8dbd9dd9b7ce2f8651c14a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696d706f6e6565722f736d617274792d786f2e737667)](http://php.net)[![Packagist](https://camo.githubusercontent.com/d01e8beb72f52da8f445f213c24754fe57fe984e88c4ac851b75429328c9239b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f696d706f6e6565722f736d617274792d786f2e737667)](https://packagist.org/packages/imponeer/smarty-xo)[![Smarty version requirement](https://camo.githubusercontent.com/c4981ce440435a602e47e0f31fad289a5b59cfbd4a2ca24ca1eb8ae052167421/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696d706f6e6565722f736d617274792d786f2f736d61727479253246736d61727479)](https://smarty-php.github.io)

Smarty XO
=========

[](#smarty-xo)

> XOOPS-inspired Smarty plugins rewritten for modern projects and exposed as a native Smarty 5 extension

This library provides a set of reusable [Smarty](https://smarty.net) plugins that originated in [XOOPS](https://xoops.org). The plugins are rewritten for licensing clarity and can be plugged into any Smarty-based project.

Installation
------------

[](#installation)

Install via [Composer](https://getcomposer.org):

```
composer require imponeer/smarty-xo
```

Otherwise, include the files from the `src/` directory manually.

Setup
-----

[](#setup)

### Registering as a native Smarty 5 extension

[](#registering-as-a-native-smarty-5-extension)

Smarty 5 supports extensions directly via [`addExtension`](https://smarty-php.github.io/smarty/stable/api/extending/extensions/). Add `XOExtension` to wire all XOOPS-style compilers and functions at once:

```
$smarty = new \Smarty\Smarty();

$smarty->addExtension(new \Imponeer\Smarty\Extensions\XO\XOExtension(
    fn (string $url): string => $url, // converts URL into path
    fn (string $url, array $params = []): string => $url . '?' . http_build_query($params), // adds params to path
    fn (string $imgPath): string => $imgPath, // makes pseudo image path real
    fn (): ?int => 0, // returns unread inbox count
    fn (string $url): string => $url, // generates URL for pagination links
    '', // next page symbol
    true // old-school URL mode
));
```

### Using with Symfony Container

[](#using-with-symfony-container)

```
# config/services.yaml
services:
    _defaults:
        autowire: true
        autoconfigure: true

    App\Smarty\PathHelper: ~
    App\Smarty\UrlHelper: ~
    App\Smarty\ImageHelper: ~
    App\Smarty\InboxCounter: ~
    App\Smarty\PageUrlHelper: ~

    Imponeer\Smarty\Extensions\XO\XOExtension:
        arguments:
            $pathCallable: ['@App\Smarty\PathHelper', 'path']
            $buildUrlCallable: ['@App\Smarty\UrlHelper', 'build']
            $imgUrlCallback: ['@App\Smarty\ImageHelper', 'resolve']
            $inboxCounterCallback: ['@App\Smarty\InboxCounter', 'countUnread']
            $pageUrlGenerator: ['@App\Smarty\PageUrlHelper', 'pageUrl']
            $strPreviousPage: ''
            $oldSchoolUrlMode: true

    Smarty\Smarty:
        calls:
            - [addExtension, ['@Imponeer\Smarty\Extensions\XO\XOExtension']]
```

### Using with PHP-DI

[](#using-with-php-di)

```
use function DI\create;
use function DI\get;
use function DI\value;

return [
    App\Smarty\PathHelper::class => create(),
    App\Smarty\UrlHelper::class => create(),
    App\Smarty\ImageHelper::class => create(),
    App\Smarty\InboxCounter::class => create(),
    App\Smarty\PageUrlHelper::class => create(),

    \Imponeer\Smarty\Extensions\XO\XOExtension::class => create()
        ->constructor(
            [get(App\Smarty\PathHelper::class), 'path'],
            [get(App\Smarty\UrlHelper::class), 'build'],
            [get(App\Smarty\ImageHelper::class), 'resolve'],
            [get(App\Smarty\InboxCounter::class), 'countUnread'],
            [get(App\Smarty\PageUrlHelper::class), 'pageUrl'],
            '',
            true
        ),

    \Smarty\Smarty::class => create()
        ->method('addExtension', get(\Imponeer\Smarty\Extensions\XO\XOExtension::class)),
];
```

### Using with League Container

[](#using-with-league-container)

```
$container = new \League\Container\Container();

$container->add(App\Smarty\PathHelper::class);
$container->add(App\Smarty\UrlHelper::class);
$container->add(App\Smarty\ImageHelper::class);
$container->add(App\Smarty\InboxCounter::class);
$container->add(App\Smarty\PageUrlHelper::class);

$container->add(\Imponeer\Smarty\Extensions\XO\XOExtension::class, function () use ($container) {
    return new \Imponeer\Smarty\Extensions\XO\XOExtension(
        [$container->get(App\Smarty\PathHelper::class), 'path'],
        [$container->get(App\Smarty\UrlHelper::class), 'build'],
        [$container->get(App\Smarty\ImageHelper::class), 'resolve'],
        [$container->get(App\Smarty\InboxCounter::class), 'countUnread'],
        [$container->get(App\Smarty\PageUrlHelper::class), 'pageUrl']
    );
});

$container->add(\Smarty\Smarty::class, function () use ($container) {
    $smarty = new \Smarty\Smarty();
    $smarty->addExtension($container->get(\Imponeer\Smarty\Extensions\XO\XOExtension::class));

    return $smarty;
});
```

### Available plugins

[](#available-plugins)

PluginDescriptionOriginal XOOPS plugin[`XOAppUrlCompiler`](./src/XOAppUrlCompiler.php)Compiles application URLs from pseudo paths.[`smarty_compiler_xoAppUrl`](https://github.com/XOOPS/XoopsCore25/blob/v2.5.8/htdocs/class/smarty/xoops_plugins/compiler.xoAppUrl.php)[`XOImgUrlCompiler`](./src/XOImgUrlCompiler.php)Resolves asset image URLs from pseudo paths.[`smarty_compiler_xoImgUrl`](https://github.com/XOOPS/XoopsCore25/blob/v2.5.8/htdocs/class/smarty/xoops_plugins/compiler.xoImgUrl.php)[`XOPageNavFunction`](./src/XOPageNavFunction.php)Renders classic page navigation links.[`smarty_function_xoPageNav`](https://github.com/XOOPS/XoopsCore25/blob/v2.5.8/htdocs/class/smarty/xoops_plugins/function.xoPageNav.php)[`XOInboxCountFunction`](./src/XOInboxCountFunction.php)Returns unread inbox message count.[`smarty_function_xoInboxCount`](https://github.com/XOOPS/XoopsCore25/blob/v2.5.8/htdocs/class/smarty/xoops_plugins/function.xoInboxCount.php)Development
-----------

[](#development)

### Code quality tools

[](#code-quality-tools)

- **PHPUnit** – unit tests in `tests/`

    ```
    vendor/bin/phpunit
    ```
- **PHPStan** – static analysis

    ```
    composer phpstan
    ```
- **PHP\_CodeSniffer** – coding standards

    ```
    composer phpcs
    ```

Contributing
------------

[](#contributing)

Contributions are welcome!

1. Fork the repository and create a feature branch.
2. Install dependencies with `composer install`.
3. If you add functionality, include or update tests and run `composer validate`.
4. Open a pull request describing the change and why it helps.

If you find a bug or have a feature request, please open an issue in the [issue tracker](https://github.com/imponeer/smarty-xo/issues).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance65

Regular maintenance activity

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~97 days

Recently: every ~68 days

Total

10

Last Release

1099d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dba53e399a507d1f60626164c8b1e340a5cc0dc4f0637f4c6aaff8fc239fdaee?d=identicon)[fiammybe](/maintainers/fiammybe)

![](https://avatars.githubusercontent.com/u/342641?v=4)[Raimondas Rimkevičius](/maintainers/MekDrop)[@MekDrop](https://github.com/MekDrop)

![](https://avatars.githubusercontent.com/u/2429107?v=4)[Steve Kenow](/maintainers/skenow)[@skenow](https://github.com/skenow)

---

Top Contributors

[![MekDrop](https://avatars.githubusercontent.com/u/342641?v=4)](https://github.com/MekDrop "MekDrop (42 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (26 commits)")[![Codex](https://avatars.githubusercontent.com/in/2248422?v=4)](https://github.com/Codex "Codex (21 commits)")[![fiammybe](https://avatars.githubusercontent.com/u/3736946?v=4)](https://github.com/fiammybe "fiammybe (2 commits)")[![mend-bolt-for-github[bot]](https://avatars.githubusercontent.com/in/16809?v=4)](https://github.com/mend-bolt-for-github[bot] "mend-bolt-for-github[bot] (1 commits)")

---

Tags

hacktoberfestlinkspaginationsmartysmarty-pluginsxoopspaginationcountersmartylinksxoopssmarty-plugins

### Embed Badge

![Health badge](/badges/imponeer-smarty-xo/health.svg)

```
[![Health](https://phpackages.com/badges/imponeer-smarty-xo/health.svg)](https://phpackages.com/packages/imponeer-smarty-xo)
```

###  Alternatives

[knplabs/knp-paginator-bundle

Paginator bundle for Symfony to automate pagination and simplify sorting and other features

1.8k44.9M357](/packages/knplabs-knp-paginator-bundle)[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87408.6k](/packages/ytake-laravel-smarty)[noiselabs/smarty-bundle

This Symfony bundle provides integration for the Smarty3 template engine.

53196.2k1](/packages/noiselabs-smarty-bundle)[text/template

Simple and secure string-template-engine (Twig-like syntax) with nested if/elseif/else, loops, filters. Simple OOP api: Just one class doing the job (2-lines of code). Fast and secure: No code-generation, no eval'ed() code. Extensible by callbacks. Fully tested. Rich examples included.

38205.8k10](/packages/text-template)[styde/blade-pagination

Laravel's pagination with Blade templating support

7214.1k](/packages/styde-blade-pagination)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
