{"id":18637963,"url":"https://github.com/imponeer/smarty-debug","last_synced_at":"2025-11-09T23:05:03.321Z","repository":{"id":38011993,"uuid":"335088426","full_name":"imponeer/smarty-debug","owner":"imponeer","description":"Smarty plugin to dump any variable with symfony/var-dumper","archived":false,"fork":false,"pushed_at":"2024-08-01T07:10:13.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-01T11:43:14.867Z","etag":null,"topics":["debugging","hacktoberfest","smarty","smarty-plugins","var-dump","var-dumper"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imponeer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-01T21:25:35.000Z","updated_at":"2024-08-01T07:10:16.000Z","dependencies_parsed_at":"2024-04-01T08:24:51.155Z","dependency_job_id":"dd8cd8ec-f946-48b2-88b0-bd2392bd684c","html_url":"https://github.com/imponeer/smarty-debug","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":"0.31999999999999995","last_synced_commit":"a1728d12b2eb6c758a5b0980f228d57bf26032b0"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fsmarty-debug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fsmarty-debug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fsmarty-debug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fsmarty-debug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imponeer","download_url":"https://codeload.github.com/imponeer/smarty-debug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223466133,"owners_count":17149768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugging","hacktoberfest","smarty","smarty-plugins","var-dump","var-dumper"],"created_at":"2024-11-07T05:38:28.431Z","updated_at":"2025-11-09T23:05:03.315Z","avatar_url":"https://github.com/imponeer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/github/license/imponeer/smarty-debug.svg)](LICENSE)\n[![GitHub release](https://img.shields.io/github/release/imponeer/smarty-debug.svg)](https://github.com/imponeer/smarty-debug/releases) [![PHP](https://img.shields.io/packagist/php-v/imponeer/smarty-debug.svg)](http://php.net)\n[![Packagist](https://img.shields.io/packagist/dm/imponeer/smarty-debug.svg)](https://packagist.org/packages/imponeer/smarty-debug)\n[![Smarty version requirement](https://img.shields.io/packagist/dependency-v/imponeer/smarty-debug/smarty%2Fsmarty)](https://smarty-php.github.io)\n\n\n# Smarty Debug\n\n\u003e Powerful debugging tools for Smarty templates\n\nThis library extends Smarty with specialized debugging capabilities, allowing developers to easily inspect variables and troubleshoot template issues. It integrates with Symfony's VarDumper component to provide rich, formatted output of complex data structures directly in your templates.\n\n## Installation\n\nTo install and use this package, we recommend to use [Composer](https://getcomposer.org):\n\n```bash\ncomposer require imponeer/smarty-debug\n```\n\nOtherwise, you need to include manually files from `src/` directory.\n\n## Setup\n\n### Basic Setup\n\nTo register the debug extension with Smarty, add the extension class to your Smarty instance:\n\n```php\n// Create a Smarty instance\n$smarty = new \\Smarty\\Smarty();\n\n// Register the debug extension\n$smarty-\u003eaddExtension(new \\Imponeer\\Smarty\\Extensions\\Debug\\DebugExtension());\n```\n\n### Using with Symfony Container\n\nTo integrate with Symfony, you can leverage autowiring, which is the recommended approach for modern Symfony applications:\n\n```yaml\n# config/services.yaml\nservices:\n    # Enable autowiring and autoconfiguration\n    _defaults:\n        autowire: true\n        autoconfigure: true\n\n    # Register your application's services\n    App\\:\n        resource: '../src/*'\n        exclude: '../src/{DependencyInjection,Entity,Tests,Kernel.php}'\n\n    # Configure Smarty with the extension\n    # The DebugExtension will be autowired automatically\n    \\Smarty\\Smarty:\n        calls:\n            - [addExtension, ['@Imponeer\\Smarty\\Extensions\\Debug\\DebugExtension']]\n```\n\nThen in your application code, you can simply retrieve the pre-configured Smarty instance:\n\n```php\n// Get the Smarty instance with the debug extension already added\n$smarty = $container-\u003eget(\\Smarty\\Smarty::class);\n```\n\n### Using with PHP-DI\n\nWith PHP-DI container, you can take advantage of autowiring for a very simple configuration:\n\n```php\nuse function DI\\create;\nuse function DI\\get;\n\nreturn [\n    // Configure Smarty with the extension\n    \\Smarty\\Smarty::class =\u003e create()\n        -\u003emethod('addExtension', get(\\Imponeer\\Smarty\\Extensions\\Debug\\DebugExtension::class))\n];\n```\n\nThen in your application code, you can retrieve the Smarty instance:\n\n```php\n// Get the configured Smarty instance\n$smarty = $container-\u003eget(\\Smarty\\Smarty::class);\n```\n\n### Using with League Container\n\nIf you're using League Container, you can register the extension like this:\n\n```php\n// Create the container\n$container = new \\League\\Container\\Container();\n\n// Register Smarty with the debug extension\n$container-\u003eadd(\\Smarty\\Smarty::class, function() {\n    $smarty = new \\Smarty\\Smarty();\n    // Configure Smarty...\n\n    // Create and add the debug extension\n    $extension = new \\Imponeer\\Smarty\\Extensions\\Debug\\DebugExtension();\n    $smarty-\u003eaddExtension($extension);\n\n    return $smarty;\n});\n```\n\nThen in your application code, you can retrieve the Smarty instance:\n\n```php\n// Get the configured Smarty instance\n$smarty = $container-\u003eget(\\Smarty\\Smarty::class);\n```\n\n\n## Usage\n\nThis extension provides modifiers that help with debugging variables in your Smarty templates.\n\n### debug_print_var\n\nThe `debug_print_var` modifier displays the content of a variable in a human-readable format. It works with various data types including strings, numbers, booleans, arrays, and objects.\n\n```smarty\n{$variable|debug_print_var}\n```\n\n#### Examples\n\n**Debugging a simple variable:**\n```smarty\n{\"Hello World\"|debug_print_var}\n```\n\n**Debugging an array:**\n```smarty\n{$userArray|debug_print_var}\n```\n\n**Debugging a template variable:**\n```smarty\n{$smarty.session|debug_print_var}\n```\n\n**Debugging a configuration variable:**\n```smarty\n{\"_AD_INSTALLEDMODULES\"|debug_print_var}\n```\n## Development\n\n### Code Quality Tools\n\nThis project uses several tools to ensure code quality:\n\n- **PHPUnit** - For unit testing\n  ```bash\n  composer test\n  ```\n\n- **PHP CodeSniffer** - For coding standards (PSR-12)\n  ```bash\n  composer phpcs    # Check code style\n  composer phpcbf   # Fix code style issues automatically\n  ```\n\n- **PHPStan** - For static analysis\n  ```bash\n  composer phpstan\n  ```\n\n## Documentation\n\nAPI 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-debug/wiki).\n\n## Contributing\n\nContributions are welcome! Here's how you can contribute:\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature-name`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin feature-name`\n5. Submit a pull request\n\nPlease make sure your code follows the PSR-12 coding standard and include tests for any new features or bug fixes.\n\nIf you find a bug or have a feature request, please create an issue in the [issue tracker](https://github.com/imponeer/smarty-debug/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimponeer%2Fsmarty-debug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimponeer%2Fsmarty-debug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimponeer%2Fsmarty-debug/lists"}