Download the PHP package kktsvetkov/smarty2 without Composer

On this page you can find all versions of the php package kktsvetkov/smarty2. 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 smarty2

Smarty 2

Smarty 2 - the PHP compiling template engine

The Smarty 2 library is still used, even 20 years after its initial inception. However, it is abandoned, as the focus has shifted to the (not-so) newer version 3, as well as other alternatives.

This project is an effort to to clean it up and make some improvements. The goal is to keep all of the class methods and their arguments the same, but still improve the underlying code and how it works. A lot of things has changed from 2001, and PHP as a whole has evolved a lot. This needs to be reflected in this project, so mainly the changes involve removing outdated features and other things we do not use, but also improving some of the codebase and bring it closely to the state of PHP nowadays (in the 2020s).

This fork is started from Smarty 2.6.31.

Installation

To get the latest stable version add this in your composer.json file:

or you can just use the composer tool:

Folders

Additionally you will need to create few folders. Using the default settings, those folders are "templates" (to read the templates from), and "templates_c" (to write the compiled templates into). If you want to use different folders, be sure to set the appropriate directory settings in Smarty for them.

Make sure the "templates_c" folder (or whatever other folder you used for compiled templates) is writable by your web server user (usually nobody):

Namespace

The project was converted to use a PSR-4 loaded namespace called Smarty2. The legacy class names of Smarty and Smarty_Compiler are still available as aliased to their descendants at Smarty2\Legacy and Smarty2\Compiler.

What is Smarty?

(from original README)

Smarty is a template engine for PHP. Many other template engines for PHP provide basic variable substitution and dynamic block functionality. Smarty takes a step further to be a "smart" template engine, adding features such as configuration files, template functions, and variable modifiers, and making all of this functionality as easy as possible to use for both programmers and template designers. Smarty also converts the templates into PHP scripts, eliminating the need to parse the templates on every invocation. This makes Smarty extremely scalable and manageable for large application needs.

Some of Smarty's features:

Resources

Template contents are read from resource objects. You can create new resources using Smarty2\Resource\ResourceInterface, or you can re-use some of the existing resources, such as:

Loaded resources are hosted in a Smarty2\Resource\Aggregate object, and this is the object you must use to register new resource object:

At the same time, the old register_resource() and unregister_resource() are preserved, and the custom callbacks used in them for the resources are used through the CustomResource class.

Security

The old security settings at $smarty->security and $smarty->security_settings are preserved in Smarty2\Legacy engine. Under the hood these settings are imported into the new Smarty2\Security\Policy classes. If you are using the new engine class, Smarty2\Engine, then in order to enforce a security policy you must set it explicitly like this:

Dropped or Deprecated Features

One of the goals for this project is to cut down any dated or legacy features, as well as exotic and questionable features that have outlived their purpose.

Debugging

The debugging console is removed. The debugging stats are collected in the Smarty::$_smarty_debug_info array, and you can inspect and render them in whatever way is best for you -- for examples something like this:

and the output will be something similar to this:

Config Vars

The config file reading is removed. In order to introduce config_vars use the Smarty::set_config_vars() method instead.

Caching

The built-in caching of the Smarty 2 project is removed from this fork. The methods used in caching are still present, but they are considered deprecated and do nothing.

Consider other options for caching for your web app, not within the presentation layer that Smarty provides.

Core Internals (from libs/internals)

The libs/internals folder is removed from the project. The some of the core internals were moved to Smarty2\Engine, while other are dropped (as they are not necessary anymore). This happened as the core internals code was refactored, with some of the functionality delegated to other classes, and some of the old unnecessary code was just dropped.

Plugins (from libs/plugins)

As the project was converted to using PSR-4 loaded namespace, the libs/ folder was dropped. The main project files are moved to src/, and the plugins/ folder is moved to the root. The SMARTY_DIR used to load the plugins is adjusted accordingly to point to the correct folder.

PHP_HANDLING

Any PHP code a la ` inside the templates will always be printed in the template in its quoted form. This is the behaviour that used to be triggered by theSMARTY_PHP_QUOTEsetting of$smarty->php_handling`. Now that's the only available option.

{php} block tags

It goes without saying how bad of an idea is to use the {php} block tags. Now all of those tags will be stripped when the template is compiled. The PHP_TAGS security option is also removed as it is no longer needed.

{include_php} tag

Again, including PHP scripts from templates is a bad ideas. Another option that made this possible was the {include_php} tag. That is now removed from this project. If you do need to use this tag, look into implementing your own custom plugin functions for this.

Dropped Plugins

These plugins have been removed from this project. If you need them for your work you can either get them from the original source code at Smarty 2.6.31 and add them as custom plugins, or you can modify your code around them.

Removed Features

Few more things stripped form this project:

Smarty2\Legacy

All of the deprecated methods are kept in the Smarty2\Legacy class. They are all empty and do nothing, but at least your code should be able to continue your existing code without any real big changes.


All versions of smarty2 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 kktsvetkov/smarty2 contains the following files

Loading the files please wait ....