{"id":36969976,"url":"https://github.com/eth8505/zend-mvc-themer","last_synced_at":"2026-01-13T21:42:49.121Z","repository":{"id":56979597,"uuid":"124936387","full_name":"eth8505/zend-mvc-themer","owner":"eth8505","description":"Module for Theming Zend\\Mvc apps","archived":true,"fork":false,"pushed_at":"2020-09-11T10:04:15.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T14:57:30.982Z","etag":null,"topics":["theming","zendframework","zendframework3","zf3-mvc"],"latest_commit_sha":null,"homepage":null,"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/eth8505.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}},"created_at":"2018-03-12T18:53:53.000Z","updated_at":"2023-01-28T12:52:50.000Z","dependencies_parsed_at":"2022-08-21T10:50:19.193Z","dependency_job_id":null,"html_url":"https://github.com/eth8505/zend-mvc-themer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eth8505/zend-mvc-themer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth8505%2Fzend-mvc-themer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth8505%2Fzend-mvc-themer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth8505%2Fzend-mvc-themer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth8505%2Fzend-mvc-themer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eth8505","download_url":"https://codeload.github.com/eth8505/zend-mvc-themer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth8505%2Fzend-mvc-themer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["theming","zendframework","zendframework3","zf3-mvc"],"created_at":"2026-01-13T21:42:48.353Z","updated_at":"2026-01-13T21:42:49.113Z","avatar_url":"https://github.com/eth8505.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Eth8505\\ZendMvcThemer - Module for Theming Zend\\Mvc apps\n==================================================================\n\n!!!IMPORTANT!!! This package is no longer maintained, as Zendframework was renamed to laminas. Please use eth85055/laminas-mvc-themer instead.\n\n\nThe **Eth8585\\ZendMvcThemer** moduole adds theming support to Zend\\Mvc apps.\n\n## How to install\n\nInstall `eth8505/zend-mvc-themer` package via composer.\n\n~~~bash\n$ composer require eth8505/zend-mvc-themer\n~~~\n\nLoad the module in your `application.config.php` file like so:\n\n~~~php\n\u003c?php\n\nreturn [\n\t'modules' =\u003e [\n\t\t'Eth8585\\ZendMvcThemer\\\\',\n\t\t// ...\n\t],\n];\n~~~\n\n## How to use\n\n### 1 Creating a theme\nAs described above, themes need to be registered with the theme plugin manager. A theme must implement the\n`ThemeInterface`. All methods exept for `getName` may return an empty array. Check the `DefaultTheme` class\nfor an empty implementation of a theme specifying only a name.\n\n#### 1.1 Specifying custom stylesheets\nImplement the `getStylesheet` method in your theme, and return an array. Note that all paths will be pushed through\nthe `BasePath` view helper and hence must be relative to your `public/` directory.\n\n~~~php\n\u003c?php\n\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemeInterface;\n\nclass MyTheme implements ThemeInterface {\n    // ...\n    public function getStylesheets() : array {\n        return [\n            'css/theme/my/custom/file.css'\n        ];\n    }\n    // ...\n}\n~~~\n\nAll stylesheets are injected using the `appendStylesheet` method of the `HeadLink` viewhelper.\n\n#### 1.2 Specifying custom javascripts\nImplement the `getScripts` method in your theme, and return an array. Note that all paths will be pushed through\nthe `BasePath` view helper and hence must be relative to your `public/` directory.\n\n~~~php\n\u003c?php\n\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemeInterface;\n\nclass MyTheme implements ThemeInterface {\n    // ...\n    public function getScripts() : array {\n        return [\n            'css/theme/my/custom/file.js'\n        ];\n    }\n    // ...\n}\n~~~\n\nAll scripts are injected using the `prependFile` method of the `HeadScript` viewhelper.\n\n#### 1.3 Specifying custom variables\nImplement the `getVariables` method in your theme, and return an array. Note that all paths will be pushed through\nthe `BasePath` view helper and hence must be relative to your `public/` directory.\n\n~~~php\n\u003c?php\n\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemeInterface;\n\nclass MyTheme implements ThemeInterface {\n    // ...\n    public function getVariables() : array {\n        return [\n            'heading1' =\u003e 'one',\n            'heading2' =\u003e [\n                'key1' =\u003e 'test'\n            ]\n        ];\n    }\n    // ...\n}\n~~~\n\nTheme variables are not automatically injected into your view models, as this could interfere with whatever you\nset in your view models. However, the module provides a `theme()` view helper allowing access to the theme variables.\n\n~~~php\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003e\u003c?= $this-\u003etheme()-\u003evar('heading1') ?\u003e\u003c/h1\u003e\n        \u003ch2\u003e\u003c?= $this-\u003etheme()-\u003evar('heading2/key1') ?\u003e\u003c/h2\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n~~~\n\n#### 1.4 Specifying custom meta tags\nMeta tags are a little more complicated than scripts, styles or variables, as there are two basic types, `name` and\n`http-equiv`. With this module, we use the same basic-syntax for both of them, specifying the `type` as a key in the\ndefinition array.\nTo implement custom meta tags, implement get `getMetaTags` method in your theme.\n\n~~~php\n\u003c?php\n\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemeInterface;\n\nclass MyTheme implements ThemeInterface {\n    // ...\n    public function getMetaTags() : array {\n        return [\n            [\n                'type' =\u003e 'name',\n                'name' =\u003e 'robots',\n                'content' =\u003e 'noindex,nofollow'\n            ],\n            [\n                'type' =\u003e 'http-equiv',\n                'name' =\u003e 'refresh',\n                'content' =\u003e '30'\n            ]\n        ];\n    }\n    // ...\n}\n~~~\n\n### 2. Register with service manager\nYou can either register your themes with the service manager via the config in your `module.config.php`:\n~~~php\n\u003c?php\n\nreturn [\n    'zend-mvc-themes' =\u003e [\n        'invokables' =\u003e [\n            MyTheme::class\n        ]\n    ]\n];\n~~~\n\nor register it in your module class using the `ThemeProviderInterface`:\n~~~php\n\u003c?php\n\nnamespace MyModule;\n\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemeProviderInterface;\n\nclass Module implements ThemeProviderInterface {\n    \n    /**\n     * @inheritdoc \n     */\n    public function getThemeConfig() {\n\n        return [\n            'invokables' =\u003e [\n                MyTheme::class\n            ]\n        ];\n        \n    }\n    \n}\n~~~\n\n### 3. Resolving themes\nPer default, theme resolving is done using the `ConfigResolver` class, that simply checks the config \n`zend-mvc-themer/resolver` config, and injects the theme as the `theme` service.\n\n#### 3.1 Custom theme resolvers\nIn addition to the default config-based theme resolver, you can also specify a custom resolver class. This can be any\nimplementation of `ThemeResolverInterface` of your choosing, reading the theme from the session (if you want to provide\na selection of themes to your users).\n\nExample implementation of a simple hostname-based theme resolver:\n\n~~~php\n\u003c?php\nnamespace MyModule;\n\nuse Eth8505\\ZendMvcThemer\\Resolver\\ThemeResolverInterface;\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemeInterface;\nuse Eth8505\\ZendMvcThemer\\Theme\\ThemePluginManager;\nuse Zend\\Http\\Request;\n\nclass Module implements ThemeResolverInterface {\n\n    private $request;\n    \n    private $pluginManager;\n\n    public function __construct(Request $request, ThemePluginManager $pluginManager) {\n        $this-\u003erequest = $request;\n        $this-\u003epluginManager = $pluginManager;\n    }\n\n    public function resolve() : ThemeInterface  {\n        \n        if ($this-\u003erequest-\u003egetUri()-\u003egetHost() === 'my.awesome.host') {\n            $theme = ThemeOne::class;\n        } else {\n            $theme = ThemeTwo::class;\n        }\n        \n        return $this-\u003epluginManager-\u003eget($theme);\n        \n    }\n\n}\n~~~\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth8505%2Fzend-mvc-themer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feth8505%2Fzend-mvc-themer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth8505%2Fzend-mvc-themer/lists"}