Download the PHP package swaroopsm/tower without Composer

On this page you can find all versions of the php package swaroopsm/tower. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tower

Tower

Build Status Code Climate Latest Stable Version Total Downloads Latest Unstable Version License

A light weight helper for simple php templating.

Why use Tower?

If you want to keep your view logic separated from the core code, Tower is for you. Tower is obviously not a full-fledged template engine. Although if you are using a PHP framework like Codeigniter, Laravel etc., Tower is again a bad solution.

Tower is best suited if for small scale web applications, where you may not need a full-fledged framework. If you decide to write a web application using plain PHP, then do check Tower.

Installing Tower

Tower is available via composer. Add the following line to your composer.json so that Tower is autoloaded into your application.

"require": {
  "swaroopsm/tower": "0.3"
}

Using Tower

Tower has a very simple and easy API consisting of a few methods.

Instantiate Tower

$tower = new Tower();

Set a template file

Tell Tower which file should be used as the template.

$tower->setTemplate('template.php');

Set variables

Tower lets you setup variables that can be used in your template.

$tower->set('name', 'Tower');
$tower->set('description', 'A simple template helper');

Render your template

Render on your browser.

$tower->render();

Template Layouting

Tower also lets you add a layout for your templates. This can be useful if for your webpages. Example on using layout in your templates;

$tower->setLayout('layout.php');

You use the $yield to render the template contents in your helper. A more detailed example on using layout is availabe at: Layout Example

Using Partials

Partials allows you to include templates in other templates thus allowing you to re-use the templates. Refer to the following code in order to set partials for your templates.

$tower->partial->set('header', 'header.php');
$tower->partial->set('footer', 'footer.php');

And to render these partials in your templates use:

<?= $partial['header'] ?>

Some stuffs here...

<?= $partial['footer'] ?>

If you decide to use a different variable for the partial instead of $partial use the following:

$tower->partial->setPrefix('towerPartial');

Now you can do the following:

<?= $towerPartial['header'] ?>

Some stuffs here...

<?= $towerPartial['footer'] ?>

Refer here for a Detailed Example

Some Goodies

Few other extra methods included in Tower.

Save to file

This is useful if you would like to dynamically save contents to a file.

$tower->save('filename.txt');

Examples


All versions of tower with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package swaroopsm/tower contains the following files

Loading the files please wait ....