Download the PHP package kocsismate90/templater without Composer

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

Templater

I developed this library for a project where I had to replace the legacy PHP templates to Twig templates. The job was enormous: we had more than 16,000 PHP tags (sometimes with dozens of lines) in 400+ files.

So thanks to Templater I managed to successfully convert (almost barely) with automatic techniques, the 92% of the different tags, and the 85% of all the tags (the majority of the difference comes from the fact that block endings, like "}" cannot be converted without extra work).

So only ~2200 tags remained for manual conversion, but it came evident soon, that it's still too slow for me. Then I introduced "partial conversion", which means that a log file stores those tags which couldn't be fully converted, but some parts of them. It's very safe and useful for long, multiline tags: your templates are not threatened with partially working tags but you can copy the most parts of them to your template file.

Suggested working method:

Copy your original templates from your project's template directory to a safe location (e.g. name the folder as "my-converted-templates"). Then make another backup of it (e.g.: name it as "my-original-templates"). Now you can use Templater to modify your files in the "my-converted-templates" directory. Finally start "merging" your new templates with the original ones in your project. Remember to check for partial conversions! If you have to re-convert the tags, you can replace "my-converted-templates" with "my-original-templates".

The advantage of this method is that you can make as many retries as you want, and modify conversion options without affecting your manually converted tags. Of course, if you have an error in your manual work, you have to find a solution to efficiently correct it.

Usage:

In the temp directory, you will get three files:

Tag injection:

You can inject your own searched and replacement tags to Templater. You have to add a {name_of_the_project}-injection.php file to the "temp" directory which returns an array. An example is:

It will convert those tags which echo a variable named "header" into an included Twig template. Important to know, that Templater starts with the conversion of possible injected tags then continues with the automatic replacements.

Static method conversion:

You can also set static method conversion with TwigTemplate::setIsConvertStaticMethods(). Currently, Templater can only convert PHP static method invocations with the following signature:

into Twig tags with the following signature:

You have to ensure that a "staticCall" function is supported by your Twig environment (e.g.: by extending it).


All versions of templater with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 kocsismate90/templater contains the following files

Loading the files please wait ....