Download the PHP package imponeer/smarty-foreachq without Composer
On this page you can find all versions of the php package imponeer/smarty-foreachq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download imponeer/smarty-foreachq
More information about imponeer/smarty-foreachq
Files in imponeer/smarty-foreachq
Package smarty-foreachq
Short Description Rewritten Smarty foreach variant that was invented for use in xoops, but nowadays is used in some other PHP based CMS'es
License MIT
Informations about the package smarty-foreachq
Smarty ForeachQ
Backward compatibility foreach implementation for legacy XOOPS and ImpressCMS templates
Rewritten (due that original use GPLv2+ license) Smarty foreach variant that was invented for use in XOOPS, but nowadays used in some other PHP based CMS'es (like ImpressCMS!).
See, original version of this smarty plugin in Xoops to see more accurate description why this plugin exists.
Installation
To install and use this package, we recommend to use Composer:
Otherwise, you need to include manually files from src/
directory.
Setup
Basic Setup
To register the ForeachQ extension with Smarty, add the extension class to your Smarty instance:
Using with Symfony Container
To integrate with Symfony, you can leverage autowiring, which is the recommended approach for modern Symfony applications:
Then in your application code, you can simply retrieve the pre-configured Smarty instance:
Using with PHP-DI
With PHP-DI container, you can take advantage of autowiring for a very simple configuration:
Then in your application code, you can retrieve the Smarty instance:
Using with League Container
If you're using League Container, you can register the extension like this:
Then in your application code, you can retrieve the Smarty instance:
Usage
Simple iteration:
With key and item:
Nested loops:
Development
Code Quality Tools
This project uses several tools to ensure code quality:
-
PHPUnit - For unit testing
-
PHP CodeSniffer - For coding standards (PSR-12)
- PHPStan - For static analysis
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.
Contributing
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin feature-name
- 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.