{"id":19020177,"url":"https://github.com/kanata-php/mustachio","last_synced_at":"2025-10-10T21:05:42.901Z","repository":{"id":63109881,"uuid":"565300635","full_name":"kanata-php/mustachio","owner":"kanata-php","description":"Stubs processor.","archived":false,"fork":false,"pushed_at":"2022-11-21T04:32:47.000Z","size":2323,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-12T15:40:28.366Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kanata-php.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["kanata-php"]}},"created_at":"2022-11-13T00:18:06.000Z","updated_at":"2022-11-13T00:41:50.000Z","dependencies_parsed_at":"2023-01-22T02:32:23.350Z","dependency_job_id":null,"html_url":"https://github.com/kanata-php/mustachio","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kanata-php/mustachio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fmustachio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fmustachio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fmustachio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fmustachio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanata-php","download_url":"https://codeload.github.com/kanata-php/mustachio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fmustachio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005332,"owners_count":26083883,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-08T20:16:01.459Z","updated_at":"2025-10-10T21:05:42.883Z","avatar_url":"https://github.com/kanata-php.png","language":"PHP","funding_links":["https://github.com/sponsors/kanata-php"],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./imgs/mustachio.svg\" height=\"200\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"left\"\u003e\n\u003ca href=\"https://github.com/kanata-php/mustachio/actions/workflows/php.yml\" alt=\"Tests\"\u003e\u003cimg src=\"https://github.com/kanata-php/mustachio/actions/workflows/php.yml/badge.svg\" alt=\"Tests\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/kanata-php/mustachio\" alt=\"Code Coverage\"\u003e \n \u003cimg src=\"https://codecov.io/gh/kanata-php/mustachio/branch/master/graph/badge.svg?token=T90GYFRWPZ\"/\u003e \n \u003c/a\u003e\n\u003c/p\u003e\n\n# Mustachio\n\nThis lib parse some template or stub. You can use it as a PHP [terminal command](#cli-phar-usage) or in your [code](#code-usage).\n\nKudos to [Mustache](https://github.com/bobthecow/mustache.php)!\n\n## Install\n\n### CLI\n\nTo use as a CLI command, you can download the phar file:\n\n\u003e **Important:** remember to replace the `version-number`!\n\n- https://github.com/kanata-php/mustachio/releases/download/{version-number}/stache .\n\n### Library\n\nInstall via composer:\n\n```shell\ncomposer require kanata-php/mustachio\n```\n\n## Usage\n\n### App Service\n\n#### Stub Parser\n\nThis can serve as a file stub parser or a very simple template engine. By default, it uses [mustache](https://github.com/bobthecow/mustache.php) to parse the input file.\n\n```php\nuse Mustachio\\Service as Stache;\n$parsedContent = Stache::parse('my content with {{PLACEHOLDER}}', ['PLACEHOLDER' =\u003e 'value']);\n// output: my content with value\n```\n\n#### Line Replacement\n\nThis can be used to replace/remove lines in files.\n\n```php\nuse Mustachio\\Service as Stache;\nStache::replaceFileLineByCondition(\n    file: '/path/to/file',\n    conditions: [\n        fn($l) =\u003e strpos($l, 'identifier-1') !== false,\n        fn($l) =\u003e strpos($l, 'identifier-2') !== false,\n    ],\n    values: [\n        'replacement-for-identifier-1',\n        'replacement-for-identifier-2',\n    ],\n    toRemove: function ($l) {\n        return strpos($l, 'identifier-to-remove') !== false;\n    },\n);\n// output: update the original file\n```\n\n### Cli Phar Usage\n\n#### Stub Parser\n\nThis can process input files giving back the output file parsed with the given placeholders.\n\n```shell\nphp bin/stache \"/path/to/my.stub\" \"/path/to/my.php\" \"PLACEHOLDER:value;PLACEHOLDER2:value2\"\n```\n\n## Tests\n\n```shell\nvendor/bin/pest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanata-php%2Fmustachio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanata-php%2Fmustachio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanata-php%2Fmustachio/lists"}