TextGenerator is a PHP package that aims to generate automated texts from data.

Overview

TextGenerator

TextGenerator is a PHP package that aims to generate automated texts from data. Feel free to comment and contribute.

Features

  • Text generation from template
  • Tags replacement
  • Text functions (core functions : random, random with probability, shuffle, if, loop, variables assignment, ...)
  • Nested function calls
  • Skip parts that contain empty values to prevent inconsistency in the generated text

Tags

The tags that appears in the template are replaced by the matching values. Example :

Data :

['my_tag' => 'dolor']

Template :

Lorem @my_tag ipsum

Output :

Lorem dolor ipsum

Template indentation

Use the ';;' special marker to indent your template. This marker can be inserted at any position in the template, any space characters (including tabs and line breaks) following the marker will be removed.

Template :

Quare hoc quidem praeceptum, cuiuscumque est. ;;
    ad tollendam amicitiam valet. ;;
        potius praecipiendum fuit. ;;
ut eam diligentiam adhiberemus.

Output :

Quare hoc quidem praeceptum, cuiuscumque est. ad tollendam amicitiam valet. potius praecipiendum fuit. ut eam diligentiam adhiberemus.

Core functions :

'set'

Set new tag within the template in order to be used further.

Data :

[
    [
        'sex' => 'f',
    ]
]

Template example :

#set{@intro|how are you ?};;
#set{@who|#if{sex == 'm'|boy|girl}};;
#set{@hello|#random{Hello|Goodbye|Hi}};;
@hello @who @intro

Output example :

Hi girl how are you ?

'if'

Display text depending on a condition. The first parameter is the condition to check for. The second parameter is returned if the condition is true. The third optional parameter is returned if the condition is false. Read more about the syntax for the conditions on the Symfony website. Examples :

#if{@val == 5|the value equals 5}
#if{@val == 5|the value equals 5|the value doesn't equal 5}
#if{@val < 5 or @val > 15|the value is lower that 5 or greater that 15|the value is between 5 and 15}
#if{(@val > 5 and @val < 15) or (@val > 10 and @val < 30)|then statement ...|else statement ...}

'expr'

Returns the evaluated expression. Read more about the syntax for the expressions on the Symfony website. Examples :

#expr{@age - (@current_year - @first_movie_year)}
#expr{(@value / @population) * 100}

'filter'

Filter the arguments in order to ouput a result, here are some examples :

#filter{upperfirst|@word} will output Lorem (if @word = lorem)
#filter{round|@value|2} will output 56.23 (if @value = 56.23346)
#filter{timestamp|d/m/Y|1470339485} will output 04/08/2016
#filter{timestamp|Y} will output 2016
#filter{date|2016-08-09|Y-m-d|d/m/Y} will output 09/08/2016
#filter{number|@value} will output 564,564 (if @value = 564564)
#filter{number|@value|0|,| } will output 564 564 (if @value = 564564)

Available filters : round, ceil, floor, max, min, rand, number, lower, upper, lowerfirst, upperfirst, upperwords, trim, substring, replace, timestamp, date. For the filters directly mapped to PHP functions, you can get more information with the PHP documentation. Custom filters can easily be added through the FilterFunction::addFilter() method.

'loop'

Handle loop on a tag that contains an array of multiple data. Arguments list :

  • 1/ The tag that contains an array to loop on
  • 2/ Maximum number of items to loop on ('*' to loop on all elements)
  • 3/ Whether the items should be shuffled or not (true/false)
  • 4/ Separator between each item
  • 5/ Separator for the last item
  • 6/ The template for each item

Example with the tag 'tag_name' that contains the array [['name' => 'Bill'], ['name' => 'Bob'], ['name' => 'John']]

Hello #loop{@tag_name|*|true|, | and |dear @name}.

It will output : Hello dear John, dear Bob and dear Bill.

'random'

Return randomly one of the arguments

Template example :

#random{first option|second option|third option}

Output example :

second option

'prandom'

Return randomly one of the arguments, taking account of the probability set to each value. In the example below, the first parameter 'one' will have 80% of chance to be output.

Template example :

#prandom{80:first option|10:second option|10:third option}

Output example :

first option

'shuffle'

Return the arguments shuffled. The first argument is the separator between each others.

Template example :

#shuffle{ |one|two|three}

Output example :

two three one

'choose'

Return the chosen argument among the list. The first argument is the ID of the argument to output (starting from 1).

Data :

[
    [
        'my_choice' => 2,
    ]
]

Template example :

#choose{1|one|two|three} #choose{@my_choice|one|two|three}

Output example :

one two

For instance, 'choose' function can be used in combination with 'set' function :

Template example :

#set{my_choice|#random{1|2|3}};;
Lorem #choose{@my_choice|one|two|three} ipsum #choose{@my_choice|first|second|third}

Output example :

Lorem two ipsum second

'coalesce'

Returns the first non empty value.

Data :

[
    [
        'my_tag1' => '',
        'my_tag2' => null,
        'my_tag3' => 'Hello',
        'my_tag4' => 'Hi',
    ]
]

Template example :

#coalesce{@my_tag1|@my_tag2|@my_tag3|@my_tag4}

Output example :

Hello

'rmna'

Return the argument only if it does not contain any empty values. It allows to prevent the display of sentences with missing values.

Data :

[
    [
        'tag1' => '', // or null
        'tag2' => 'ok', 
    ]
]

Template example :

#rmna{test 1 : @tag1};;
#rmna{test 2 : @tag2}

Output :

test 2 : ok

Complete example :

Template :

#set{@pronoun|#if{@sex == 'm'|He|She}};;
@firstname @lastname is an @nationality #if{@sex == 'm'|actor|actress} of @age years old. ;;
@pronoun was born in @birthdate in @birth_city (@birth_country). ;;
#shuffle{ |;;
    #random{Throughout|During|All along} #if{sex == 'm'|his|her} career, #random{@pronoun|@lastname} was nominated @nominations_number time#if{@nominations_number > 1|s} for the oscars and has won @awards_number time#if{@awards_number > 1|s}.|;;
    #if{@awards_number > 1 and (@awards_number / @nominations_number) >= 0.5|@lastname is accustomed to win oscars.}|;;
    @firstname @lastname first movie, "@first_movie_name", was shot in @first_movie_year (at #expr{@age - (#filter{timestamp|Y} - @first_movie_year)} years old).|;;
    One of #if{@sex == 'm'|his|her} most #random{famous|important|major} #random{film|movie} is @famous_movie_name and has been released in @famous_movie_year. ;;
        #prandom{20:|80:Indeed, }@famous_movie_name #random{earned|gained|made|obtained} $#filter{number|@famous_movie_earn} #random{worldwide|#random{across|around} the world}. ;;
        #loop{@other_famous_movies|*|true|, | and |@name (@year)} are some other great movies from @lastname.;;
}

Data :

[
    [
        'firstname' => 'Leonardo',
        'lastname' => 'DiCaprio',
        'birthdate' => 'November 11, 1974',
        'age' => 41,
        'sex' => 'm',
        'nationality' => 'American',
        'birth_city' => 'Hollywood',
        'birth_country' => 'US',
        'awards_number' => 1,
        'nominations_number' => 6,
        'movies_number' => 37,
        'first_movie_name' => 'Critters 3',
        'first_movie_year' => 1991,
        'famous_movie_name' => 'Titanic',
        'famous_movie_year' => 1997,
        'famous_movie_earn' => '2185372302',
        'other_famous_movies' => [
            [
                'name' => 'Catch Me If You Can',
                'year' => 2002
            ],
            [
                'name' => 'Shutter Island',
                'year' => 2010
            ],
            [
                'name' => 'Inception',
                'year' => 2010
            ],
        ]
    ],
    [
        'firstname' => 'Jodie',
        'lastname' => 'Foster',
        'birthdate' => 'November 19, 1962',
        'age' => 51,
        'sex' => 'f',
        'nationality' => 'American',
        'birth_city' => 'Los Angeles',
        'birth_country' => 'US',
        'awards_number' => 2,
        'nominations_number' => 4,
        'movies_number' => 75,
        'first_movie_name' => 'My Sister Hank',
        'first_movie_year' => 1972,
        'famous_movie_name' => 'Taxi Driver',
        'famous_movie_year' => 1976,
        'famous_movie_earn' => '28262574',
        'other_famous_movies' => [
            [
                'name' => 'The Silence of the Lambs',
                'year' => 1991
            ],
            [
                'name' => 'Contact',
                'year' => null // Empty values are skipped by the parser
            ],
            [
                'name' => 'The Accused',
                'year' => 1988
            ],
        ]
    ],
]

Output :

Leonardo DiCaprio is an American actor of 41 years old. He was born in November 11, 1974 in Hollywood (US). One of his most famous film is Titanic and has been released in 1997. Indeed, Titanic obtained $2,185,372,302 around the world. Catch Me If You Can (2002), Inception (2010) and Shutter Island (2010) are some other great movies from DiCaprio. Leonardo DiCaprio first movie, "Critters 3", was shot in 1991 (at 16 years old). All along his career, He was nominated 6 times for the oscars and has won 1 time.

Jodie Foster is an American actress of 51 years old. She was born in November 19, 1962 in Los Angeles (US). Foster is accustomed to win oscars. One of her most important film is Taxi Driver and has been released in 1976. Indeed, Taxi Driver obtained $28,262,574 worldwide. The Accused (1988) and The Silence of the Lambs (1991) are some other great movies from Foster. Jodie Foster first movie, "My Sister Hank", was shot in 1972 (at 7 years old). Throughout her career, Foster was nominated 4 times for the oscars and has won 2 times.

Create a new function

You can extend the TextGenerator capabilities by adding your own text funtions. In order to create a new function for the TextGenerator, you just have to implement the FunctionInterface and call registerFunction() method on the TextGenerator instance. Then, you will be able to call it from your templates.

Install

$ composer require neveldo/text-generator
Comments
  • reuse TextGenerator instance

    reuse TextGenerator instance

    if we use one instance several times for generate different templates, we have buggly output.

    short example:

            $textGenerator = new TextGenerator();
            $textGenerator->compile("My test 1 #random{one|two}");
            $result = $textGenerator->generate([]);
    
            $textGenerator->compile("My test 2 #random{red|green}");
            $result2 = $textGenerator->generate([]);
    

    OUTPUT: test 2 redest 2 [1]red

    The problem: sortedStatementsStack not reset before compile.

    opened by rik43 5
  • Shuffle two or more #loops

    Shuffle two or more #loops

    Hi, is it posssible two shuffle two or more loops? Something like this:

    #shuffle{ |;;
        #loop{@txt_1|1|true|||@txt}| ;;
        #loop{@txt_2|1|true|||@txt}
    }
    
    opened by bigbadmytyx 0
  • Add ability to do a reproducable random choice

    Add ability to do a reproducable random choice

    I needed a function that allowed me to do a random choice, but keep the choice linked to a seed value so that the text would stay constant over subsequent runs (even when the template has changed, only the new parts change, the rest stays the same).

    Interested in a PR?

    opened by loekvangool 2
  • Impossible to set two interdependent variables for demonstrative pronoun (Der, Die, Das)

    Impossible to set two interdependent variables for demonstrative pronoun (Der, Die, Das)

    It is not possible to set interdependend variable. This will set @word always to "Vespa" and @dempron always to "Die"

    #random{
    #set{@word|Auto}#set{@dempron|Das}|
    #set{@word|Bus}#set{@dempron|Der}|
    #set{@word|Vespa}#set{@dempron|Die}
    }
    

    It is necessary to change "Das Auto" to "dieses Auto" or "dem Auto. This doesn't work either

    #set{#random{Das Auto|Der Bus|Die Vespa}}
    

    Because i can't check if there is "Der", "Die" or "Das" in a variable.

    Goal is to make a text like this: Was sagen sie zu dem Auto? Das Auto ist schön. Deshalb möchte ich dieses Auto kaufen.

    opened by gregorvogel 0
  • symfony Error - T_ENCAPSED_AND_WHITESPACE

    symfony Error - T_ENCAPSED_AND_WHITESPACE

    Hey nice project,

    but i cant run it :( Maybee you can help.

      $TG = new TextGenerator();
      $TG->compile("#if{@val == 5|the value equals 5|the value doesn't equal 5}");
      echo $TG->generate(array("val"=>5));
    
    Parse error: syntax error, unexpected ''/[a-zA-Z_\x7f-\xff][a-zA-Z0-9' (T_ENCAPSED_AND_WHITESPACE) in [...]/vendor/symfony/expression-language/Parser.php on line 328
    
    opened by StrongLucky 1
  • Google Sheets; column add

    Google Sheets; column add

    if I add a column in google spread sheet (did not try delete) before the columns where I had previously defied the column data for the generator; the data is either lost or the column information is out of sync in the edit screen of the test generator.

    opened by wnnj 6
  • generator eating random words

    generator eating random words

    `<?php mb_internal_encoding("UTF-8");

    if (! file_exists(DIR . '/../../vendor/autoload.php')) { echo "Please run 'composer install' on the root directory before running the sample script."; return; }

    require DIR . '/../../vendor/autoload.php';

    use Neveldo\TextGenerator\TextGenerator; $data = [

    [
        'sex' => 'f',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'f',
        'sexg' => 'm',
        'itemip' => 'шкаф',
        'itemvp' => 'шкаф',
        'itemdp' => 'шкафу',
        'itempp' => 'шкафе'
    
    ],
    [
        'sex' => 'm',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'f',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'f',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'm',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'm',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'm',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'm',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ],
    [
        'sex' => 'm',
        'sexg' => 'f',
        'itemip' => 'люстрa',
        'itemvp' => 'люстру',
        'itemdp' => 'люстрe',
        'itempp' => 'люстрe'
    
    ]
    

    ]; $template = <<<EOF #set{@hellor|#random{Здраствуйте|Привет|Привет всем|Добрый день|Всем привет}};; #set{@hello|#prandom{10:|90:@hellor, }};;

    #set{@aaa|#if{sex == 'f'|а|}};; #set{@iiuy|#if{sex == 'm'|ий|ую}};; #set{@aaiaiiy|#if{sex == 'm'|ый|ая}};; #set{@aassia|#if{sex == 'm'|ся|ась}};;

    #set{@ag|#if{sexg == 'f'|а|}};; #set{@negog|#if{sexg == 'm'|него|нее}};; #set{@oiuyg|#if{sexg == 'm'|ой|ю}};; #set{@iiuyg|#if{sexg == 'm'|ий|ую}};; #set{@aaiaiiyg|#if{sexg == 'm'|ый|ая}};; #set{@aassiag|#if{sexg == 'm'|ся|ась}};;

    #set{@etotg|#if{sexg == 'm'|этот|эта} @itemip};; #set{@etug|#if{sexg == 'm'|этот|эту} @itemvp};; #set{@egog|#if{sexg == 'm'|его|ее}};; #set{@takomg|#if{sexg == 'm'|таком|такой} @itempp};; #set{@takuyg|#if{sexg == 'm'|такого|такую} @itemvp};; #set{@takoyg|#if{sexg == 'm'|такой|такую} @itemvp};;

    #set{@want|#random{|давно }#random{хотел@aaa именно @takoyg|искал@aaa именно @takoyg|мечтала о #random{@takomg}}};;

    #set{@service|#random{купить|приобрел|заказал|взял}};;

    #set{@buydo|#random{купить|приобрести|заказать|взять}};; #set{@buym|#random{купил|приобрел|заказал|взял}};; #set{@buyf|#random{купила|приобрла|заказала|взяла}};; #set{@buy|#if{sex == 'm'|@buym|@buyf}};; #set{@buyitem|@buy #random{@takoyg|@etug|@egog} #random{|здесь }#random{в этом магазине|на сайте|в интернет магазине}};;

    #set{@emo|#random{класс|супер}};; #set{@super|#random{класс|супер}};; #set{@silno|#random{очень|сильно|}};; #set{@coolseemw|#random{престижно|стильно|кашерно|солидно}};; #set{@seemw|#random{выглядет|смотрится}};; #set{@seem|#random{улет|класс|супер|огонь|офигенно}};; #set{@see|@seemw #random{это|-|} просто @seem};;

    #set{@imho|#random{@itemip #random{|мне}@silno понравил@aassiag|отличный сайт}};; #set{@shvy|#random{стыки|швы}};; #set{@seeshvy|#random{нет #random{никаких #random{лишних|} #random{щелей|зазоров},|} #random{все|} @shvy #random{идеальные|идеально ровные} #random{не к чему придраться|не придерешся|}}};; #set{@seeassembly|#random{идеальная|качественная|отличная} #random{сборано|сделанно|изготовленно} из #random{хороших|качественных|приятных} материалов};; #set{@seefeel|#random{#random{по ощюениям|на ощюп|} #random{приятная|качественная#random{, дорогая|}|дорогая#random{, качественная|} вещ}|#random{ощющается|чувствуется} что вещ}};;

    #set{@subrealsee|#random{@seeshvy|@seeassembly|@seefeel}};;

    #set{@realsee|#random{в реальности|в жизни|на деле|} @seemw #random{приятнее|лутше|красивее} чем на #random{фото|картинке|сайте} @subrealsee};;

    #set{@isee|@coolseemw @seemw, @realsee};; #set{@goodnow|};;

    #set{@select|#random{|так вот }#random{здесь|тут} #random{#random{выбор|линейка|линейка товаров} #random{гораздо |}#random{лутше|шире|красивее|на любой вкус}|#random{большой|широкий} выбор}};;

    #set{@notfind|#random{#random{|только }#random{|зря} #random{потратил@aaa|убил@aaa} #random{столько времени|время}|ничего #random{ подходящего| приличного |хороего |}не #if{sex == 'm'|нашел|нашла}}};; #set{@walkstory|#random{#random{исколесил@aaa|#if{sex == 'm'|обошел|обошла}|изъездил@aaa} #random{кучу|много} магазинов|#random{#if{sex == 'm'|прошел|прошла}|#if{sex == 'm'|обошел|обошла}|#if{sex == 'm'|зашел|зашла} во} все #random{#random{доступные|известные} #random{мне |}магазины}|#random{прошел@aassia|прогулял@aassia} по всем #random{#random{доступным|известным} #random{мне |}магазинам}}};;

    #set{@cat|#random{разделено на категории|разложенно по категорииям|поделено на категории|разбито на категории}};;

    #set{@findstory|#random{все #random{очень|довольно} #random{красиво|доступно|просто|понятно} #random{#random{удобно|хорошо}|} представленно|#random{находиться|расположенно} #random{в одном месте|на одном сайте} @cat, очень удобно.| #random{наконец#random{ таки|-то} выбрала|#if{sex == 'm'|нашел|нашла}} #random{сво@oiuyg|} #random{любим@iiuyg|} @itemvp}};;

    #set{@bigstory|#random{вообще #random{тут|здесь}} #random{огромный|широкий|большой} #random{выбор|ассортимент}, #random{|@walkstory @notfind, }#random{#if{sex == 'm'|зашел|зашла}|#if{sex == 'm'|перешел|перешла}} на сайит @findstory. #random{очень рад@aaa|#random{|до сих пор }радуюсь} что #random{#if{sex == 'm'|нашел|нашла} сайт|#if{sex == 'm'|зашел|зашла} сюда|#if{sex == 'm'|зашел|зашла} на сайт}#random{, pекомендую|}};;

    #set{@clickstory|#random{#random{нажал@aaa|кликнул@aaa} #random{кноку купить|кноку заказать|кноку оформить заказ|на кнопку оформления заказа}|#random{1 нажатие|одно нажатие|1 клик|один клик}} #random{ввел@aaa|забил@aaa} #random{свои|} #random{данные|контаты}, #random{мне позвонил менеджер|со мной связались|мне #random{|быстро} перезвонили}, #random{|все |заказ }#random{доставили|привезли} #random{в тот же день|на следующий день}};; #set{@longfindstory|#random{очень} долго #random{искал@aaa|искали} #random{подходящ@iiuyg|хорош@iiuyg} @itemvp #random{под дизайн|под интерьер}#random{,|#random{, то по #random{цвету|материалам} не подходил@aaa, то по #random{стилю|дизайну}, то по #random{размерам|габаритам}, a|}} @etotg просто #random{великолепн@ag|замечателн@aaiaiiyg}, влюбил@aassia в @negog сразу };; #set{@repairstory|#random{мы|} #random{делали|сделали|делаем} ремонт, @longfindstory};;

    #set{@thankyou|};;

    #set{@story|#random{@clickstory|@repairstory|@walkstory @notfind|@bigstory}};; @hello#random{@want|@buyitem}, #random{@story|@imho} @thankyou

    EOF;

    $textGenerator = new TextGenerator(); $textGenerator->compile($template);

    foreach ($data as $row) { echo $textGenerator->generate($row) . "\n\n"; }`

    INPUT: #set{@clickstory|#random{#random{нажал@aaa|кликнул@aaa} #random{кноку купить|кноку заказать|кноку оформить заказ|на кнопку оформления заказа}|#random{1 нажатие|одно нажатие|1 клик|один клик}} #random{ввел@aaa|забил@aaa} #random{свои|} #random{данные|контаты}, #random{мне позвонил менеджер|со мной связались|мне #random{|быстро} перезвонили}, #random{|все |заказ }#random{доставили|привезли} #random{в тот же день|на следующий день}};;` OUTPUT: Привет всем, давно мечтала о такой люстрe, 1 нажатие данные, мне быстро перезвонили, все привезли в тот же день EATING: #random{ввел@aaa|забил@aaa}

    INPUT: #set{@want|#random{|давно }#random{хотел@aaa именно @takoyg|искал@aaa именно @takoyg|мечтал@aaa о #random{@takomg}}};; OUTPUT: давно

    PS

    PHP 7.1.10 (cli) (built: Sep 27 2017 09:03:44) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.10, Copyright (c) 1999-2017, by Zend Technologies

    opened by mgkirs 4
Releases(1.7.0)
Owner
Vincent Brouté
Web engineer @ Groupe Figaro CCM Benchmark - Interested in web development, opendata, linkeddata, statistical learning and dataviz.
Vincent Brouté
Laravel package template

REPLACE Simple and flexible package template. Usage Replace all occurances of REPLACE (case sensitive) with the name of the package namespace. E.g. th

ARCHTECH 56 Aug 15, 2022
Document templates Laravel package is intended for creating/managing user editable document template

Document Templates Introduction Document templates Laravel package is intended for creating/managing user editable document templates, with ability to

42coders 139 Dec 15, 2022
PHP template engine for native PHP templates

FOIL PHP template engine, for PHP templates. Foil brings all the flexibility and power of modern template engines to native PHP templates. Write simpl

Foil PHP 167 Dec 3, 2022
A PHP project template with PHP 8.1, Laminas Framework and Doctrine

A PHP project template with PHP 8.1, Laminas Framework and Doctrine

Henrik Thesing 3 Mar 8, 2022
Twig, the flexible, fast, and secure template language for PHP

Twig, the flexible, fast, and secure template language for PHP Twig is a template language for PHP, released under the new BSD license (code and docum

Twig 7.7k Jan 1, 2023
A Mustache implementation in PHP.

Mustache.php A Mustache implementation in PHP. Usage A quick example: <?php $m = new Mustache_Engine(array('entity_flags' => ENT_QUOTES)); echo $m->re

Justin Hileman 3.2k Dec 24, 2022
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.

Smarty 3 template engine smarty.net Documentation For documentation see www.smarty.net/docs/en/ Requirements Smarty can be run with PHP 5.2 to PHP 7.4

Smarty PHP Template Engine 2.1k Jan 1, 2023
Native PHP template system

Plates Plates is a native PHP template system that's fast, easy to use and easy to extend. It's inspired by the excellent Twig template engine and str

The League of Extraordinary Packages 1.3k Jan 7, 2023
☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites.

Latte: amazing template engine for PHP Introduction Latte is a template engine for PHP which eases your work and ensures the output is protected again

Nette Foundation 898 Dec 25, 2022
Multi target HAML (HAML for PHP, Twig, )

Multi target HAML MtHaml is a PHP implementation of the HAML language which can target multiple languages. Currently supported targets are PHP and Twi

Arnaud Le Blanc 363 Nov 21, 2022
PHP Template Attribute Language — template engine for XSS-proof well-formed XHTML and HTML5 pages

PHPTAL - Template Attribute Language for PHP Requirements If you want to use the builtin internationalisation system (I18N), the php-gettext extension

PHPTAL 175 Dec 13, 2022
View template engine of PHP extracted from Laravel

Blade 【简体中文】 This is a view templating engine which is extracted from Laravel. It's independent without relying on Laravel's Container or any others.

刘小乐 143 Dec 13, 2022
PHP 5.3 Mustache implementation

Phly\Mustache MOVED! This package has moved to phly/phly-mustache, and the package name has changed to phly/phly-mustache. I have updated packagist to

phly 123 Jan 11, 2022
Provides TemplateView and TwoStepView using PHP as the templating language, with support for partials, sections, and helpers.

Aura View This package provides an implementation of the TemplateView and TwoStepView patterns using PHP itself as the templating language. It support

Aura for PHP 83 Jan 3, 2023
A complete and fully-functional implementation of the Jade template language for PHP

Tale Jade for PHP Finally a fully-functional, complete and clean port of the Jade language to PHP — Abraham Lincoln The Tale Jade Template Engine brin

Talesoft 91 Dec 27, 2022
A faster, safer templating library for PHP

Brainy Brainy is a replacement for the popular Smarty templating language. It is a fork from the Smarty 3 trunk. Brainy is still very new and it's lik

Box 66 Jan 3, 2023
A ready-to-use Model View Controller template in PHP

PHP-MVC-Template A ready-to-use Model View Controller template in PHP Use this repo as a template! (Or clone it) Start to configure your MVC file Afte

Loule | Louis 20 Dec 26, 2022
Derste birlikte hazırladığımız PHP Tema Motoru kaynak kodları

Prototürk Template Engine Prototürk'de sorulan bir soru üzerine videoda birlikte hazırladığımız php ile geliştirilmiş basit bir tema motoru. Geçerli d

Tayfun Erbilen 20 Nov 9, 2022
The free-to-use template for your Imagehost-website made with PHP, HTML and CSS!

The free-to-use template for your Imagehost-website made with PHP, HTML and CSS! Some information before we start This repo is only code related, to a

Ilian 6 Jul 22, 2022