PHP Classes

waPluginator: Generate sets of source files from templates

Recommend this page to a friend!
  Info   View files Documentation   Screenshots Screenshots   View files View files (12)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-21 (23 days ago) RSS 2.0 feedStarStarStarStar 72%Total: 309 This week: 3All time: 7,281 This week: 270Up
Version License PHP version Categories
wapluginator 0.8MIT/X Consortium ...5.3PHP 5, Templates, Configuration
Description Author

This package can generate sets of source files from templates.

It can take a set of template files and process them replacing values from forms that configure the relevant template variables.

The templates are defined in a XML files that determines if the files are in a directory or a zip archive, as well the variable values to be taken from forms.

It also specifies color schemes to use to use in forms that can be read from separate files.

The templates can be processed with template processing class provided bt the package or external processors like scss or less for instance.

Innovation Award
PHP Programming Innovation award nominee
October 2016
Number 7


Prize: One downloadable copy of PhpED Professional
Some projects need to create files of different types, for instance to create themes and other types of configuration plugins.

Usually these files can be created from templates but if you need non-technical users to edit those files, they will not be able to do it because it is more complicated than they can handle.

This package provides a better alternative that consists in defining parameters that the users can edit using regular Web forms, thus without having to edit templates or configuration files.

Manuel Lemos
Picture of Alexander Selifonov
  Performance   Level  
Name: Alexander Selifonov <contact>
Classes: 20 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 16x

Winner: 2x

Details

Code generator for modules, plugins and landing pages

Majority of web applications, CMS systems, frameworks use "modular" (or plugin) architecture. It allows easy developing of new functionality and adding it to the system independently from other modules. Quite often modules, or plugins, have a similar structure, so it would be great to have a kind of "template" with places for inserting specific "variable" values, and then create "initial stub" for a new module with these values inside. After that developer can modify generated files, adding needed specific (function implementation, CSS styling etc.)

Another often task is creating a collection of files for a "single page" - for example, adaptive landing page, based on predefined design.

For example, you want to create a landing page based on some royalty free pages available in internet, but you don't want each time to search places where to insert your titles, text blocks, css color codes etc.

In that case you just modify source page files, by adding special macros (like %textblock01%), and describe them in waPluginator config file.

waPluginator renders an html "designer" form for choosing template, entering user values and executing the "module creation process".

Using example

include_once('waPluginator/waPluginator.php');
// waPluginator::setBaseUri('./backend.php'); // Use it if you have your own backend module
waPluginator::autoLocalize();
waPluginator::setOptions(array(
        'appname' =>'Your application name'
       ,'author' =>'My Name'
       ,'email' =>'Myemail [at] acme.com'
       ,'link' =>'http://www.yoursite.com'
    )
);
$params = array_merge($_GET,$_POST);
if(!empty($params['action'])) {
    waPluginator::performAction($params);
    exit;
}
else {
    app::setPageTitle('Plugin generator');
    app::appendHtml('<br>');
    app::appendHtml(waPluginator::designerForm(true));
    app::finalize();
}

waPluginator uses CodePreprocessor to parse template files, but it allows attaching any additional text/source code processors (compilers), like "scss to css", "less to css" etc. You can attach compiler if it is implemented as PHP class with callable "compiling" method.

Working demo can be found in demo folder - generator.php

See using details in wiki

Screenshots  
  • waPluginator.png
  Files folder image Files  
File Role Description
Files folder imagedemo (4 files)
Files folder imagelib (1 file)
Files folder imagesrc (5 files)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  demo  
File Role Description
  Accessible without login Plain text file as_jsfunclib.js Data Auxiliary data
  Accessible without login Plain text file generator.php Example Example
  Accessible without login Plain text file jquery-2.2.2.min.js Data Auxiliary data
  Accessible without login Plain text file styles.css Data Auxiliary data

  Files folder image Files  /  lib  
File Role Description
  Plain text file class.codePreprocessor.php Class Class source

  Files folder image Files  /  src  
File Role Description
  Accessible without login Plain text file colorSchemes.xml Data Auxiliary data
  Accessible without login Plain text file waPluginator.lng.en.php Conf. Configuration script
  Accessible without login Plain text file waPluginator.lng.ru.php Conf. Configuration script
  Plain text file waPluginator.php Class Class source
  Accessible without login Plain text file waPluginator.xml Data Auxiliary data

Downloadwapluginator-2022-10-21.zip 72KB
Downloadwapluginator-2022-10-21.tar.gz 71KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP Code Preprocessor Download .zip .tar.gz Uses preprocessor in main action Required
 Version Control Unique User Downloads Download Rankings  
 100%
Total:309
This week:3
All time:7,281
This week:270Up
 User Ratings  
 
 All time
Utility:93%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:81%StarStarStarStarStar
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:72%StarStarStarStar
Rank:263
  
For more information send a message to info at phpclasses dot org.