PHPackages                             haringsrob/twill-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. haringsrob/twill-generator

ActiveLibrary[Templating &amp; Views](/categories/templating)

haringsrob/twill-generator
==========================

:package\_description

701[2 issues](https://github.com/haringsrob/twill-generator/issues)PHP

Since Mar 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/haringsrob/twill-generator)[ Packagist](https://packagist.org/packages/haringsrob/twill-generator)[ RSS](/packages/haringsrob-twill-generator/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

TwillGenerator
==============

[](#twillgenerator)

What is it
----------

[](#what-is-it)

This package can generate blocks based on html markup for rapidly building sites in Twill 3.

You can take a template file, annotate it and feed it to the package where it will take care of converting it.

Currently the blade files are NOT formatted, so you need to reformat them using your editor of choice.

This is a dev/proof of concept package. Feel free to submit more features! This package is not my priority, so I most likely will not actively work on your feature requests.

Installation
------------

[](#installation)

```
$ composer require haringsrob/twill-generator --dev
```

Usage
-----

[](#usage)

### Input

[](#input)

While this example only contains "one block" you can use a full html file as well. It will strip out what is not needed.

```

      The next generation page builder

      The generator that simply takes your markup and converts it into building blocks

        Contact us

```

See (./tests/example.html)\[this example\] for a more complete file.

Then we can run `twill-generator:generate-blocks-for-file {file}` and it will extract the blocks into classes.

You will have to confirm what the parser found:

```
The following block components will be created:
+---------------+---------------+---------------+------------+-------------------------------------------------------+----------------------------------------------------+
| block name    | label         | field name    | field type | dir                                                   | class                                              |
+---------------+---------------+---------------+------------+-------------------------------------------------------+----------------------------------------------------+
| hero          |               |               |            | views/components/twill/blocks/hero.blade.php          | /app/View/Components/Twill/Blocks/Hero.php         |
|               | Link Text     | link_text     | text       |                                                       |                                                    |
|               | Title         | title         | wysiwyg    |                                                       |                                                    |
|               | Text          | text          | wysiwyg    |                                                       |                                                    |
|               | Link Url      | link_url      | href       |                                                       |                                                    |
+---------------+---------------+---------------+------------+-------------------------------------------------------+----------------------------------------------------+

```

### Output

[](#output)

`resources/components/twill/blocks/quote.blade.php`

```

    {{ $input('title') }}
    {{ $input('quote') }}

```

`app/View/Components/Twill/Blocks/Quote.php`

```
