{"id":18721044,"url":"https://github.com/mauricius/templateengineblade","last_synced_at":"2025-04-12T14:30:16.967Z","repository":{"id":66196105,"uuid":"64335382","full_name":"mauricius/TemplateEngineBlade","owner":"mauricius","description":"ProcessWire module to add Laravel's Blade templating engine to ProcessWire, enforcing MVC and separation of concerns.","archived":false,"fork":false,"pushed_at":"2019-11-02T12:09:51.000Z","size":8,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T09:01:47.823Z","etag":null,"topics":["blade","laravel","processwire","template-engine"],"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/mauricius.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":"2016-07-27T19:17:11.000Z","updated_at":"2020-11-12T00:24:04.000Z","dependencies_parsed_at":"2023-03-18T03:45:12.265Z","dependency_job_id":null,"html_url":"https://github.com/mauricius/TemplateEngineBlade","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricius%2FTemplateEngineBlade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricius%2FTemplateEngineBlade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricius%2FTemplateEngineBlade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricius%2FTemplateEngineBlade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauricius","download_url":"https://codeload.github.com/mauricius/TemplateEngineBlade/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248580893,"owners_count":21128075,"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":["blade","laravel","processwire","template-engine"],"created_at":"2024-11-07T13:33:23.284Z","updated_at":"2025-04-12T14:30:16.944Z","avatar_url":"https://github.com/mauricius.png","language":"PHP","readme":"# TemplateEngineBlade\n\nProcessWire module to add [Laravel's Blade](https://laravel.com/docs/5.1/blade) templating engine to ProcessWire, enforcing MVC and separation of concerns.\n\nInspired by the wonderful [TemplateEngineFactory](https://github.com/wanze/TemplateEngineFactory) module. Check it out to get more information about the motivations that led me to build this module.\n\n## Requirements\n\n* Composer\n* PHP \u003e= 5.6.0\n* ProcessWire 3\n\n## Installation\n\nInstall the module like any other ProcessWire module. Download the files and place them into the `TemplateEngineBlade` folder inside `site/modules`.\n\nCheck out the following guide for more information: [http://modules.processwire.com/install-uninstall/](http://modules.processwire.com/install-uninstall/).\n\nNext you should install the dependencies. Run the following command from the module's folder:\n\n```\ncomposer install\n```\n\n## Configuration\n\n* **Path to templates** Path to folder where you want to store your Blade template files.\n* **API variable** This is the variable you can use in the controllers (aka ProcessWire templates) to access the template of the current page\n* **Template files suffix** The suffix of the template files, default is *blade.php*.\n* **Import ProcessWire API variables in Blade templates** If checked, any API variable is accessible inside the Smarty templates, for example *{{ $page }}* refers to the current page.\n\n## Features\n\nAll Blade's features are supported:\n\n* Template inheritance\n* Sections\n* Includes\n* Control structures\n\nUnder the hood this module uses [Philo's Laravel-Blade package](https://github.com/PhiloNL/Laravel-Blade).\n\n## Usage\n\nThe module uses template files under `/site/templates/` as controllers that do the logic, delegating the output/markup to a corresponding view file. The default convention is the same of the `TemplateEngineFactory` module: the view file has the same name as the controller (aka ProcessWire template). If no template file is found, the factory assumes that the controller does not output markup over the template engine. In this case, everything works as normal.\n\nThe API variable is an instance of `Illuminate\\View\\Factory` so you can use [all the methods](https://laravel.com/api/5.1/Illuminate/View/Factory.html) provided by the class. For example, provided that `view` is the name of your API variable configured for the module, you can use:\n\n```\n$view-\u003eshare('foo', 'bar');\n```\n\nto add a variable to the environment.\n\nYou can also decide to render different files based on some conditions, for example:\n\n```php\n// In controller gallery.php\n\n$gallery = $pages-\u003efind('...');\n\n$view-\u003eshare('gallery', $gallery);\n\nif($input-\u003eurlSegment1 == 'grid')\n{\n    return $view-\u003emake('gallery.grid', ['title' =\u003e 'Display gallery as a grid']);\n}\nelseif($input-\u003eurlSegment1 == 'list')\n{\n    return $view-\u003emake('gallery.list', ['title' =\u003e 'Display gallery as a list']);\n}\n\n// in every other case it renders the gallery.blade.php view file\n\n```\n\nNote the _dot-notation_ to access files inside a subfolder.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricius%2Ftemplateengineblade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauricius%2Ftemplateengineblade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricius%2Ftemplateengineblade/lists"}