{"id":20903503,"url":"https://github.com/phly/phlysimplepage","last_synced_at":"2025-05-13T04:33:19.565Z","repository":{"id":5914710,"uuid":"7133999","full_name":"phly/PhlySimplePage","owner":"phly","description":"ZF2 module for easily creating static pages","archived":false,"fork":false,"pushed_at":"2021-12-10T18:51:01.000Z","size":79,"stargazers_count":34,"open_issues_count":5,"forks_count":12,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-21T12:19:44.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-12T17:00:20.000Z","updated_at":"2024-11-20T00:09:38.000Z","dependencies_parsed_at":"2022-08-26T12:12:34.274Z","dependency_job_id":null,"html_url":"https://github.com/phly/PhlySimplePage","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlySimplePage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlySimplePage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlySimplePage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlySimplePage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phly","download_url":"https://codeload.github.com/phly/PhlySimplePage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877265,"owners_count":21977632,"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":[],"created_at":"2024-11-18T13:13:45.156Z","updated_at":"2025-05-13T04:33:17.775Z","avatar_url":"https://github.com/phly.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhlySimplePage\n\nA Laminas MVC module for \"static\" pages.\n\n## Overview\n\nIn most Laminas MVC applications, you'll have at least a few pages that are\nbasically static — the controller contains no logic for the given endpoint, and\nit simply renders a template.\n\nBy default, this requires the following steps:\n\n- Create a route\n- Create a controller (if you don't have one already)\n- Create an action in that controller\n- Create a template\n\nThis module halves the workflow by eliminating the middle two steps.\n\n## Installation\n\nUse [Composer](https://getcomposer.org):\n\n```console\n$ composer require phly/phly-simple-page\n```\n\n## Enable the module\n\nIf you are using [laminas-component-installer](https://docs.laminas.dev/laminas-component-installer),\nyou will get prompted to add the module to your `config/application.config.php`\nfile.\n\nIf you are not, or you choose not to use the component installer, you can enable\nit by adding manually it to your `config/application.config.php` file:\n\n```php\n\u003c?php\nreturn [\n    'modules' =\u003e [\n        'PhlySimplePage',\n        'Application',\n    ],\n];\n```\n\n## Usage\n\nCreate configuration in your application, mapping a route to the controller\n`PhlySimplePage\\PageController`, and specifying a `template` key in the route\ndefaults.\n\n```php\nuse PhlySimplePage\\PageController;\n\nreturn [\n    'router' =\u003e [\n        'routes' =\u003e [\n            'about' =\u003e [\n                'type' =\u003e 'Literal',\n                'options' =\u003e [\n                    'route' =\u003e '/about',\n                    'defaults' =\u003e [\n                        'controller' =\u003e PageController::class,\n                        'template'   =\u003e 'application/pages/about',\n                        // optionally set a specific layout for this page\n                        'layout'     =\u003e 'layout/some-layout',\n                    ],\n                ],\n            ],\n        ],\n    ],\n];\n```\n\nThen, make sure you create a template for the page. In the above example, I'd \nlikely create the file in `module/Application/view/application/pages/about.phtml`.\n\n## Caching\n\nYou can enable a write-through cache for all pages served by the\n`PageController`. This is done via the following steps:\n\n- Creating cache configuration\n- Enabling the page cache factory\n\nTo create cache configuration, create a `phly-simple-page` configuration key in\nyour configuration, with a `cache` subkey, and configuration suitable for\n`Laminas\\Cache\\StorageFactory::factory`. As an example, the following would setup\nfilesystem caching:\n\n```php\nreturn [\n    'phly-simple-page' =\u003e [\n        'cache' =\u003e [\n            'adapter' =\u003e [\n                'name'   =\u003e 'filesystem',\n                'options' =\u003e [\n                    'namespace'       =\u003e 'pages',\n                    'cache_dir'       =\u003e getcwd() . '/data/cache',\n                    'dir_permission'  =\u003e '0777',\n                    'file_permission' =\u003e '0666',\n                ],\n            ],\n        ],\n    ],\n];\n```\n\nTo enable the page cache factory, do the following:\n\n```php\nreturn [\n    'service_manager' =\u003e [\n        'factories' =\u003e [\n            'PhlySimplePage\\PageCache' =\u003e \\PhlySimplePage\\PageCacheFactory::class,\n        ],\n    ],\n];\n```\n\n### Selectively disabling caching for given routes\n\nIf you do **not** want to cache a specific page/route, you can disable it by\nadding the default key `do_not_cache` with a boolean `true` value to the route.\nAs an example:\n\n```php\n'about' =\u003e [\n    'type' =\u003e 'Literal',\n    'options' =\u003e [\n        'route' =\u003e '/about',\n        'defaults' =\u003e [\n            'controller'   =\u003e \\PhlySimplePage\\PageController::class,\n            'template'     =\u003e 'application/pages/about',\n            'do_not_cache' =\u003e true,\n        ],\n    ],\n],\n```\n\n### Clearing the cache\n\nTo clear the cache for any given page, or for all pages, your cache adapter (a)\nmust support cache removal from the command line (APC, ZendServer, and several\nother adapters do not), and (b) must support flushing if you wish to clear all\npage caches at once.\n\nThe module provides a vendor binary, `phly-simple-page` for accomplishing this:\n\n- `./vendor/bin/phly-simple-page clear:cache` will clear all cached pages at\n  once.\n\n- `./vendor/bin/phly-simple-page clear:cache --page=` clear a single\n  cached page; use the template name you used in the routing configuration as\n  the page value.\n\n## TODO\n\n- Ability to clear sets of pages\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphly%2Fphlysimplepage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphly%2Fphlysimplepage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphly%2Fphlysimplepage/lists"}