{"id":17865797,"url":"https://github.com/ttskch/twiggedswiftmessageserviceprovider","last_synced_at":"2025-10-07T08:26:54.673Z","repository":{"id":20299914,"uuid":"23573628","full_name":"ttskch/TwiggedSwiftMessageServiceProvider","owner":"ttskch","description":"Twig templated Swift_Message builder service provider for the Silex microframework.","archived":false,"fork":false,"pushed_at":"2016-09-23T09:22:12.000Z","size":110,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-23T13:31:41.027Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ttskch.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":"2014-09-02T09:57:54.000Z","updated_at":"2016-05-20T06:06:24.000Z","dependencies_parsed_at":"2022-09-05T22:01:18.672Z","dependency_job_id":null,"html_url":"https://github.com/ttskch/TwiggedSwiftMessageServiceProvider","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ttskch/TwiggedSwiftMessageServiceProvider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttskch%2FTwiggedSwiftMessageServiceProvider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttskch%2FTwiggedSwiftMessageServiceProvider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttskch%2FTwiggedSwiftMessageServiceProvider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttskch%2FTwiggedSwiftMessageServiceProvider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttskch","download_url":"https://codeload.github.com/ttskch/TwiggedSwiftMessageServiceProvider/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttskch%2FTwiggedSwiftMessageServiceProvider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278742459,"owners_count":26037822,"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-07T02:00:06.786Z","response_time":59,"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-10-28T09:25:01.784Z","updated_at":"2025-10-07T08:26:54.639Z","avatar_url":"https://github.com/ttskch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TwiggedSwiftMessageServiceProvider\n\n[![Build Status](https://travis-ci.org/ttskch/TwiggedSwiftMessageServiceProvider.svg?branch=master)](https://travis-ci.org/ttskch/TwiggedSwiftMessageServiceProvider)\n[![Latest Stable Version](https://poser.pugx.org/ttskch/twigged-swiftmessage-service-provider/v/stable.svg)](https://packagist.org/packages/ttskch/twigged-swiftmessage-service-provider)\n[![Total Downloads](https://poser.pugx.org/ttskch/twigged-swiftmessage-service-provider/downloads.svg)](https://packagist.org/packages/ttskch/twigged-swiftmessage-service-provider)\n\nThis is a service provider of [TwiggedSwiftMessageBuilder](https://github.com/ttskch/TwiggedSwiftMessageBuilder) for [Silex](http://silex.sensiolabs.org/).\n\n## Requirements\n\n* PHP 5.3+\n\n## Getting started\n\nFirst add this dependency into your `composer.json`:\n\n```json\n{\n    \"require\": {\n        \"ttskch/twigged-swiftmessage-service-provider\": \"~2.0\"\n    }\n}\n```\n\nAnd enable this service provider in your application.\nPlease notice that you must register both `TwigServiceProvider` and `SwiftmailerServiceProvider` on ahead.\n\n```php\n$app-\u003eregister(new TwigServiceProvider());\n$app-\u003eregister(new SwiftmailerServiceProvider());\n$app-\u003eregister(new \\Ttskch\\Silex\\Provider\\TwiggedSwiftMessageServiceProvider());\n```\n\nThen you can build `Swift_Message` object via twig template.\n\n```php\n$message = $app['twigged_message']-\u003ebuildMessage('email.txt.twig');\n$message-\u003esetTo('hoge@example.com');\n$app['mailer']-\u003esend($message);\n```\n\nSee more detailed documentation [here](https://github.com/ttskch/TwiggedSwiftMessageBuilder/blob/master/README.md).\n\n## Use submitted form data in Twig template\n\nThis service provider provides one additional feature to use submitted form data in Twig template easily.\n`$app['twigged_swiftmessage.form_handler']` allows you to extract data array from `Form` object.\n\nLabels and values of each fields can be used as below:\n\n * `{{ form.[field-name].label }}`\n * `{{ form.[field-name].value }}`\n\nFor example:\n\n```twig\n{# email.txt.twig #}\n\n{% block from %}{{ form.email.value }}{% endblock %}\n{% block from_name %}{{ form.name.value }}{% endblock %}\n{% block to %}contact@example.com{% endblock %}\n\n{% block subject %}[Contact] {{ form.summary.value }}{% endblock %}\n\n{% block body %}\n{% for item in form %}\n----------------------------------------------------------------------\n{{ item.label }}: {{ item.value }}\n{% endfor %}\n----------------------------------------------------------------------\n{% endblock %}\n```\n\n```php\n// in your controller.\n\n$form-\u003ehandleRequest($request);\nif ($form-\u003eisValid()) {\n    $array = $app['twigged_message.form_handler']-\u003egetDataArray($form);\n    $message = $app['twigged_message']-\u003ebuildMessage('email.txt.twig', array('form' =\u003e $array));\n    $app['mailer']-\u003esend($message);\n}\n```\n\nOffcourse you also can access to your custom field type as below:\n\n * `{{ form.[parent-field].[child-field].label }}`\n * `{{ form.[parent-field].[child-field].value }}`\n\n## Enjoy!\n\nSee more detailed documentation [here](https://github.com/ttskch/TwiggedSwiftMessageBuilder/blob/master/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttskch%2Ftwiggedswiftmessageserviceprovider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttskch%2Ftwiggedswiftmessageserviceprovider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttskch%2Ftwiggedswiftmessageserviceprovider/lists"}