2017 © Pedro Peláez
 

library generator

Struk Generator

image

strukt/generator

Struk Generator

  • Saturday, January 27, 2018
  • by pitsolu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 172 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 8 % Grown

The README.md

Strukt Generator

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Intro

Simple package for generating templates and reading annotations., (*2)

Templator

$data = array(

    "title" => "The Title",
    "subtitle" => "Subtitle",
    "footer" => "Foot",
    "people" => array(

        array("name" => "Steve","surname" => "Johnson"),
        array("name" => "James", "surname" => "Johnson"),
        array("name" => "Josh", "surname" => "Smith")
    ),
    "page" => "Home"
);

$tpl = "<html>
<title>{{title}}</title>
<body>


{{subtitle}}

{{begin:people}} <b>{{name}}</b> {{surname}}<br /> {{end:people}} <br /><br /> <i>{{footer}}</i> </body> </html>"; $output = Strukt\Templator::create($tpl, $data);

Annotations

Annotation supported format:, (*3)

/**
* @Route(/)
*/
class DefaultController{

    /**
    * @Route(/hello/{to:alpha})
    * @Method(POST, GET)
    * @Provides(application/html) 
    */
    function hello($to){ ...

    /**
    * @Route(/login)
    * @Method(GET)
    * @Secure(username=test, password=test)
    * @Expects(username,password)
    *
    * note the below will not be parsed
    * @param str $username
    * @param str $password
    */
    function login($username, $password){ ...

Run parser:, (*4)

$parser = new \Strukt\Annotation\Parser\Basic(new \ReflectionClass("\Controller\DefaultController"));
print_r($parser->getAnnotations());

The Versions

27/01 2018

dev-master

9999999-dev

Struk Generator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Moderator