• php logo
  • smarty logo
  • adodb logo
  • SourceForge.net Logo
  • zend framework logo

What is Tangra Framework?

Tangra is a framework for development of PHP5 applications. Its main target is to boost the productivity of the developers. It consist code library, modules and control center. General idea is by providing consistent, robust and powerful tools and environment to free the developers from annoying repetitive tasks and let them concentrate on important parts of the applications.

Tangra framework is not intended for use on high load sites. It is more suitable for intranet or extranet environments where reliability, feature richness and usability are more important than serving 50 000+ hits per hour.

Basic principle is modularity – most of the classes that will be used directly by the users are placed into modules and just the core functionality resides in the code library. That way new module features and bug fixes can be easily distributed and end users will be able to upgrade by single click, letting modules manager to take care about the compatibility and dependencies.

    What we have now:
  • Tangra code library (TCL) is mature and stable (more than 11k lines (not commented, not empty) of pure PHP5 code, ~104 classes)
  • Tangra modules - 52 modules, most of them considered "base"
  • HTML templates for forms and grids generators
  • phpdoc generated API reference
  • Tangra PHP code conventions
  • Tangra Control Center (web IDE for Tangra) - includes modules manager, site templates manager, site manager.
  • Quick start tutorial
    Still to come:
  • Future development of this site;
  • Tangra programmer's manual;
  • New general purpose modules.

Problems / topics that Tangra Framework addresses

Separation between data, logic and presentation

Biggest problem of most of "old-school" php applications is the mess created by php files that contain both PHP code, HTML and SQL queries. Such applications are hard to maintain and enhance. Tangra framework separates logic, data and presentation as follows:
  • .class.php and .inc.php files contain logic
  • .tpl files contain HTML. Template engine (default Smarty) is used to process .tpl files
  • classes implementing I_DB_Storable interface define data structures and encapsulate DB operations
Although for example forms are processed in Model-View-Controller fashion Tangra Framework itself is not MVC based. MVC is well suited for monolith applications written in C++, Java and similar languages but for web applications it is a burden. TF model is targeted to reflect more directly web abstractions as "Site", "Web Page", "Form", "Grid", etc.

Database (RDBMS) independence

When a PHP application is created it usually uses MySQL for RDBMS. If that application evolves in time and needs more scalability it may happen that MySQL have to be replaced by some more serious RDBMS like Oracle or PostgreSQL but usual PHP application have hardcoded mysql_* functions calls in it and replacing them is almost impossible. Tangra Framework by default uses ADOdb as DB abstraction layer. That way, in theory, is possible to change the underlaying RDBMS and application will continue to work happily without even knowing that DB is changed. In practice things are more complicated but transition from one RDBMS to another is a quite possible task. That way you may create more portable and scalable applications.

Plans for next versions of TF include creation of DBAL modules for other AL as PDO and Zend Framework's zend_db.

Modularity

Core concept in Tangra Framework is modularity. You are presented with a choice of currently 53 modules. When creating new application you may choose site template which contains predefined set of modules. You don't like that set? No, problem - you can define your own. TCC's module manager will ensure that modules that you install are meeting their dependencies so you are freed by the burden to worry "is module X compatible with module Y".

Modularity provides code reusability. Way spending 100 hours developing something that is already created, tested, packaged into module and ready to use? On the other side - you can create your own modules and share them with Tangra developer community.

Elimination of wasting time in repetitive tasks and grunt work

Form and Grid related classes and modules provide unified mechanism for creating forms and grids. You will never again have to manually check common form fields for validity by yourself. Tangra Framework provides classes for common fields like text, integer, money, integer_limited, date, email, file, hidden, number, number_fixed, password, radio_group, select, select_multiple, textarea, etc.

Grids classes provide automatic pagination and easier way of defining filters and sortings.

Modules like form_html_tpl_static_ajax_metallic-1.0.0 provide set of HTML templates for forms and form fields. You just have to define what fields you want and then HTML will be generated for you.

Team work

Tangra framework heavily uses new PHP5 features as classes and exceptions. Data hiding and encapsulation in conjunction with separation between data, logic and presentation makes easier to work in team because it is more difficult to step on each others feet.

Tangra PHP5 Code Conventions provide a set of rules and recommendations that make reading other's code easier because it looks like just like your code.

Project's late stages problems

If you used other frameworks for PHP may be you encountered a situation when project is almost finished but you face a problem that cannot be solved with the framework because of some internal limitation. Framework does not allows you to bent the rules and time is running, deadline pressure is raising and you are in trouble.

Such thing cannot happen with Tangra Framework - it provides a set of functionality, has limitations but in no way prevents you from going "free style". You will be able to continue to use TF features but you can also bent limitations as much as you want.

Testing

Usual PHP applications are nightmare to test. In most cases you have to open your browser and manually test each feature in order to be sure that it is working.

Tangra Framework provides mechanism for automated testing. Each page is working in context which can be externally loaded and fed to the page class. That way you can create scripts that simulate different scenarios and user behavior.

Maintenance

Finding and correcting bugs takes big part of total effort spent on a web project. TF provides option of automatic save of the context in case of error. Later you can load this context file and fed it into the page class in order to debug what exactly went wrong and on which line that happened. Time to find and fix a bug is shortened.