Download the PHP package eclipxe/engineworks-templates without Composer

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

eclipxe/engineworks-templates - PHP Templates with plugins

Source Code Latest Version Software License Build Status Scrutinizer Coverage Status Total Downloads

This library is just for running PHP Templates. Similar projects: Slim/Php-View

PHP is a powerfull template engine by itself, you might not need a template library as Twig, Plates or Smarty. It depends on the problem you are facing, maybe you are working with a legacy system, maybe you just don't want it.

Installation

Use composer to install this library composer require eclipxe/engineworks-templates

Basic use

About the objects

EngineWorks\Templates\Templates

This class works as a factory of Template objects, it helps to locate this objects with a common Callables object, in a common directory with a common file extension.

The most common used method would be fetch. It simply creates a Template using the file specified by directory plus name + extension, with the default callables. Then will call fetch on that template.

EngineWorks\Templates\Template

This is the main class of the library, it can be created stand alone or by Templates::create (non-static call).

EngineWorks\Templates\Template::fetch

fetch method receives two arguments, a template name and a variables array. It will resolve the file name using the Resolver object. It will convert the array to variables (using extract) in order to make accesible these variables to the file.

Inside the template

The template file is a PHP file, it will have all the variables that were set to fetch method. Also, you can use $this, wich is refered to the EngineWorks\Templates\Template object.

The $this object offer some functions registered in the Callables object, in the example above the $callables was attatched with the following functions:

So, you can use those functions using $this inside your template.

Also, you can use the fetch method to retrieve the content of another template.

This is a template example templates/users-list.php:

This is the templates call:

This would be the result:

Integrations

Integrate with PSR-7

In order to integrate with a PSR-7 compatible library you can use the method render. This method is act as a decorator to fetch the template and write the contents into the ResponseInterface object.

You only need to use this method in case you are using a PSR-7 compatible library. Otherwise, I recommend you to use fetch method. As this is optional, the psr/http-message package is not a composer dependence.

Integrate with Slim 4

To use this library in Slim 4 we provide a plugin named Slim4Plugin that offers two methods:

This is a common code to attach the plugin into the Callables collection:

Compatibility

Version 2.x was compatible with PHP 5.4 or higher. It's no longer maintained. Version 3.x is compatible with PHP 7.3 or higher.

Contributing

Contributions are welcome! Please read CONTRIBUTING for details and don't forget to take a look on the TODO and CHANGELOG files.

Copyright and License

The EngineWorks\Templates library is copyright © Carlos C Soto and licensed for use under the MIT License (MIT). Please see LICENSE for more information.


All versions of engineworks-templates with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
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 eclipxe/engineworks-templates contains the following files

Loading the files please wait ....