{"id":49551949,"url":"https://github.com/vanvanni/marko-blade","last_synced_at":"2026-05-08T04:02:05.369Z","repository":{"id":355033093,"uuid":"1226370456","full_name":"vanvanni/marko-blade","owner":"vanvanni","description":"Blade-style templating for Marko. Laravel-based syntax to modern UI components.","archived":false,"fork":false,"pushed_at":"2026-05-02T21:45:11.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-02T23:11:54.464Z","etag":null,"topics":["blade","marko","marko-php","template-engine"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanvanni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-01T10:02:27.000Z","updated_at":"2026-05-02T21:45:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vanvanni/marko-blade","commit_stats":null,"previous_names":["vanvanni/marko-blade"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/vanvanni/marko-blade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanvanni%2Fmarko-blade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanvanni%2Fmarko-blade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanvanni%2Fmarko-blade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanvanni%2Fmarko-blade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanvanni","download_url":"https://codeload.github.com/vanvanni/marko-blade/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanvanni%2Fmarko-blade/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32589264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"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":["blade","marko","marko-php","template-engine"],"created_at":"2026-05-02T23:01:45.619Z","updated_at":"2026-05-04T00:01:49.851Z","avatar_url":"https://github.com/vanvanni.png","language":"PHP","funding_links":[],"categories":["Modules"],"sub_categories":[],"readme":"# Marko Blade\n\nThe past 10 years I have been running Laravel, brought there due to Blade one day. Now I developed a great love for\nBlade templating engine and wanted to bring it to the Marko Framework.\n\n## Installation\n\n```bash\ncomposer require vanvanni/marko-blade\n```\n\nThis automatically installs `marko/view`.\n\n## Configuration\n\nConfigure via the `view` config key:\n\n```php\nreturn [\n    'cache_directory' =\u003e '/path/to/cache',\n    'extension' =\u003e '.blade.php',\n    'auto_refresh' =\u003e true,  // Set false in production\n    'strict_types' =\u003e false, // Blade does not support strict types\n];\n```\n\n## Usage\n\nTemplates are rendered using the module namespace syntax:\n\n```php\nuse Marko\\View\\ViewInterface;\n\n$view-\u003erender('blog::post/index', ['posts' =\u003e $posts]);\n```\n\nThe format is `module::path/to/template` where:\n\n- `module` is the module name (e.g., `blog`, `admin`)\n- `path/to/template` is the path within `resources/views/`\n\nUse `renderToString()` when you need the raw HTML:\n\n```php\n$html = $view-\u003erenderToString('blog::email/welcome', $data);\n```\n\n### Blade Directives\n\nAll Blade directives work out of the box:\n\n```blade\n@extends('blog::layout')\n\n@section('content')\n    @foreach($posts as $post)\n        @include('blog::post.item', ['post' =\u003e $post])\n    @endforeach\n@endsection\n```\n\nIncludes must use the module namespace format:\n\n```blade\n@include('blog::post/list/item', ['post' =\u003e $post])\n@include('blog::pagination/index', ['pagination' =\u003e $posts])\n```\n\nRelative paths (`../`) are not supported. This ensures consistent syntax throughout templates.\n\n### Components\n\nAnonymous Blade components are supported:\n\n```blade\n\u003cx-blog::alert type=\"error\" :message=\"$message\" /\u003e\n```\n\n## Using with `marko/vite`\n\n`marko-blade` requires `illuminate/view`, which in turn requires `illuminate/support`. Both `illuminate/support` and `marko/vite` (via `marko/env`) define a global `env()` helper.\n\nBecause both packages use `function_exists('env')` guards, no fatal error occurs. In practice, Laravel's `env()` typically loads first (it is a deeper dependency in Composer's graph) and is used. Both implementations are compatible for typical config usage — both coerce `'true'` → `true`, `'false'` → `false`, `'null'` → `null`, and `'empty'` → `''`.\n\n`illuminate/support` lists `vlucas/phpdotenv` as a suggested dependency, but its `Env` class cannot function without it. `marko-blade` explicitly requires `vlucas/phpdotenv` so Laravel's `env()` works correctly in any Marko project, even when the framework itself is not installed.\n\n### `@viteHeadTags` Blade Directive\n\nWhen `marko/vite` is installed and enabled, `marko-blade` automatically registers a `@viteHeadTags` directive:\n\n```blade\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    @viteHeadTags\n    \u003ctitle\u003eMy App\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    ...\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nBy default, it uses the entry point configured in `config/vite.php` (`vite.entry`). You can also pass a specific entry:\n\n```blade\n@viteHeadTags('app/web/resources/js/app.js')\n```\n\nIn development mode (`vite.useDevServer = true`), this emits `\u003cscript type=\"module\"\u003e` tags pointing at the Vite dev server. In production, it reads the manifest and emits hashed `\u003cscript\u003e`, `\u003clink rel=\"stylesheet\"\u003e`, and `\u003clink rel=\"modulepreload\"\u003e` tags.\n\n## Differences from Latte\n\n- **Strict Types**: Blade does not support `strict_types` because compiled templates are `include`d at runtime.\n- **Auto Refresh**: When `auto_refresh` is `false`, templates are only compiled once. In production, you should set this\n  to `false`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanvanni%2Fmarko-blade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanvanni%2Fmarko-blade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanvanni%2Fmarko-blade/lists"}