PHPackages                             imponeer/smarty-includeq - 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-includeq

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

imponeer/smarty-includeq
========================

Rewritten smarty 'include' variant that was invented for use in XOOPS, but nowadays is used in some other PHP based CMS'es

v3.0.2(5mo ago)120.6k↓33.3%MITPHPPHP ^8.3CI passing

Since Feb 3Pushed 3mo ago2 watchersCompare

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

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

[![License](https://camo.githubusercontent.com/fbae184c85022a4df1aebdb97a8944d135d3f484026df89d8ceea2d93ae7374b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d706f6e6565722f736d617274792d696e636c756465712e737667)](LICENSE) [![GitHub release](https://camo.githubusercontent.com/33121ec69aeb2723aaf6aed787e3c3926c5a76f2719142575c7bb45830cb8a52/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f696d706f6e6565722f736d617274792d696e636c756465712e737667)](https://github.com/imponeer/smarty-includeq/releases) [![PHP](https://camo.githubusercontent.com/ebee0097665d1e73d71fad5ac4a1fdd5c73bd3ae28c03657adac8578a35c1109/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696d706f6e6565722f736d617274792d696e636c756465712e737667)](http://php.net) [![Packagist](https://camo.githubusercontent.com/7ed90ae92800a4b80fb80ed9662e8e2276d817ae8a4fc55677da9f47f172845a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f696d706f6e6565722f736d617274792d696e636c756465712e737667)](https://packagist.org/packages/imponeer/smarty-includeq) [![Smarty version requirement](https://camo.githubusercontent.com/01078e1782fee560f76518b47a35719624f998d24a49e8120f7ff51a1ec73360/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696d706f6e6565722f736d617274792d696e636c756465712f736d61727479253246736d61727479)](https://smarty-php.github.io)

Smarty IncludeQ
===============

[](#smarty-includeq)

This library provides a rewritten version of the Smarty `{include}` tag variant originally developed for [XOOPS](https://xoops.org) CMS. The `{includeq}` tag offers enhanced template inclusion capabilities and is now used across various PHP-based content management systems, including [ImpressCMS](https://impresscms.org).

This implementation was created as a clean-room rewrite to avoid GPL licensing constraints while maintaining full compatibility with the original functionality. The plugin extends Smarty's template inclusion system with additional features specifically designed for CMS environments.

For reference, see the [original XOOPS implementation](https://github.com/XOOPS/XoopsCore25/blob/v2.5.8/htdocs/class/smarty/xoops_plugins/compiler.includeq.php) to understand the historical context and requirements this plugin addresses.

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

[](#installation)

To install and use this package, we recommend to use [Composer](https://getcomposer.org):

```
composer require imponeer/smarty-includeq
```

Otherwise, you need to include manually files from `src/` directory.

Setup
-----

[](#setup)

### Modern Smarty Extension (Recommended)

[](#modern-smarty-extension-recommended)

For Smarty 5.x, use the modern extension system by adding the extension to your Smarty instance:

```
// Create a Smarty instance
$smarty = new \Smarty\Smarty();

// Register the IncludeQ extension
$smarty->addExtension(new \Imponeer\Smarty\Extensions\IncludeQ\IncludeQExtension());
```

### Legacy Plugin Registration

[](#legacy-plugin-registration)

For compatibility with older Smarty versions or legacy code, you can register the compiler directly:

```
$smarty = new \Smarty();
$includeqPlugin = new \Imponeer\Smarty\Extensions\IncludeQ\IncludeQCompiler();
$smarty->registerPlugin('compiler', 'includeq', [$includeqPlugin, 'compile']);
```

### Using with Dependency Injection Containers

[](#using-with-dependency-injection-containers)

#### Symfony Container

[](#symfony-container)

To integrate with Symfony, you can leverage autowiring:

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

    # Configure Smarty with the extension
    \Smarty\Smarty:
        calls:
            - [addExtension, ['@Imponeer\Smarty\Extensions\IncludeQ\IncludeQExtension']]
```

#### PHP-DI Container

[](#php-di-container)

With PHP-DI container:

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

return [
    \Smarty\Smarty::class => create()
        ->method('addExtension', get(\Imponeer\Smarty\Extensions\IncludeQ\IncludeQExtension::class))
];
```

#### League Container

[](#league-container)

If you're using League Container, you can register the extension like this:

```
// Create the container
$container = new \League\Container\Container();

// Register Smarty with the IncludeQ extension
$container->add(\Smarty\Smarty::class, function() {
    $smarty = new \Smarty\Smarty();
    // Configure Smarty...

    // Create and add the IncludeQ extension
    $extension = new \Imponeer\Smarty\Extensions\IncludeQ\IncludeQExtension();
    $smarty->addExtension($extension);

    return $smarty;
});
```

Then in your application code, you can retrieve the Smarty instance:

```
// Get the configured Smarty instance
$smarty = $container->get(\Smarty\Smarty::class);
```

Usage
-----

[](#usage)

The `{includeq}` tag provides enhanced template inclusion capabilities with support for variable passing and output assignment.

### Basic Template Inclusion

[](#basic-template-inclusion)

Simple template inclusion:

```
{includeq file="header.tpl"}
```

### Passing Variables to Included Templates

[](#passing-variables-to-included-templates)

You can pass variables to the included template:

```
{includeq file="user_profile.tpl" user_id=123 show_avatar=true}
```

### Assigning Output to a Variable

[](#assigning-output-to-a-variable)

Capture the output of the included template into a variable:

```
{includeq file="sidebar.tpl" assign="sidebar_content"}
{* Now you can use $sidebar_content variable *}

    {$sidebar_content}

```

### Advanced Examples

[](#advanced-examples)

**Including with dynamic file names:**

```
{includeq file="modules/{$module_name}/template.tpl" module_data=$data}
```

**Conditional inclusion with assignment:**

```
{if $show_sidebar}
    {includeq file="sidebar.tpl" assign="sidebar" user=$current_user}
{/if}
```

**Including with complex variable passing:**

```
{includeq file="product_list.tpl"
          products=$products
          show_prices=true
          currency="USD"
          per_page=20}
```

Development
-----------

[](#development)

### Code Quality Tools

[](#code-quality-tools)

This project uses several tools to ensure code quality:

- **PHPUnit** - For unit testing

    ```
    composer test
    ```
- **PHP CodeSniffer** - For coding standards (PSR-12)

    ```
    composer phpcs    # Check code style
    composer phpcbf   # Fix code style issues automatically
    ```
- **PHPStan** - For static analysis

    ```
    composer phpstan
    ```

Documentation
-------------

[](#documentation)

API documentation is automatically generated and available in the project's wiki. For more detailed information about the classes and methods, please refer to the [project wiki](https://github.com/imponeer/smarty-includeq/wiki).

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

[](#contributing)

Contributions are welcome! Here's how you can contribute:

1. Fork the repository
2. Create a feature branch: `git checkout -b feature-name`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature-name`
5. Submit a pull request

Please make sure your code follows the PSR-12 coding standard and include tests for any new features or bug fixes.

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

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance76

Regular maintenance activity

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

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 ~125 days

Recently: every ~243 days

Total

15

Last Release

168d ago

Major Versions

v1.1.7 → v2.0.02023-01-04

v2.0.2 → v3.0.02025-07-17

PHP version history (3 changes)v1.0.0PHP &gt;=7.1

v2.0.0PHP ^7.3 || ^8.0

v3.0.0PHP ^8.3

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/7255f306e0ca27292c50cdd9644c1c04e0d7b0f54bf35e0cdd79dc55c83b4923?d=identicon)[MekDrop](/maintainers/MekDrop)

![](https://www.gravatar.com/avatar/79009323fafcd4974bb1713b12eea0a610f01c4fb21cc5e85d446c4cb66453d4?d=identicon)[skenow](/maintainers/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] (22 commits)")[![fiammybe](https://avatars.githubusercontent.com/u/3736946?v=4)](https://github.com/fiammybe "fiammybe (3 commits)")[![Codex](https://avatars.githubusercontent.com/in/2248422?v=4)](https://github.com/Codex "Codex (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

composer-libraryhacktoberfestincludesmartysmarty-pluginssmartyincludexoopssmarty-plugins

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

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

This Symfony bundle provides integration for the Smarty3 template engine.

53194.4k1](/packages/noiselabs-smarty-bundle)[latrell/smarty

This package lets you run Smarty3 on Laravel5 elegantly.

127.0k](/packages/latrell-smarty)

PHPackages © 2026

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