Download the PHP package slim/views without Composer

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

Slim Views

This repository contains custom View classes for the template frameworks listed below. You can use any of these custom View classes by either requiring the appropriate class in your Slim Framework bootstrap file and initialize your Slim application using an instance of the selected View class or using Composer (the recommended way).

Slim Views only officially support the following views listed below.

How to Install

using Composer

Install in your project by running the following composer command:

Smarty

How to use

To use Smarty options do the following:

Twig

How to use

To use Twig options do the following:

In addition to all of this we also have a few helper functions which are included for both view parsers. In order to start using these you can add them to their respective view parser as stated below:

Twig

Smarty

These helpers are listed below.

urlFor

Twig

Inside your Twig template you would write:

{{ urlFor('hello', {"name": "Josh", "age": "19"}) }}

You can easily pass variables that are objects or arrays by doing:

<a href="{{ urlFor('hello', {"name": person.name, "age": person.age}) }}">Hello {{ name }}</a>

If you need to specify the appname for the getInstance method in the urlFor functions, set it as the third parameter of the function in your template:

<a href="{{ urlFor('hello', {"name": person.name, "age": person.age}, 'admin') }}">Hello {{ name }}</a>

Smarty

Inside your Smarty template you would write:

{urlFor name="hello" options="name.Josh|age.26"}

or with the new array syntax:

{urlFor name="hello" options=["name" => "Josh", "age" => "26"]}

You can easily pass variables that are arrays as normal or using the (.):

<a href="{urlFor name="hello" options="name.{$person.name}|age.{$person.age}"}">Hello {$name}</a>

If you need to specify the appname for the getInstance method in the urlFor functions, set the appname parameter in your function:

<a href="{urlFor name="hello" appname="admin" options="name.{$person.name}|age.{$person.age}"}">Hello {$name}</a>

siteUrl

Twig

Inside your Twig template you would write:

{{ siteUrl('/about/me') }}

Smarty

Inside your Smarty template you would write:

{siteUrl url='/about/me'}

baseUrl

Twig

Inside your Twig template you would write:

{{ baseUrl() }}

Smarty

Inside your Smarty template you would write:

{baseUrl}

currentUrl

Twig

Inside your Twig template you would write:

{{ currentUrl() }}

Smarty

Inside your Smarty template you would write:

{currentUrl}

Authors

Josh Lockhart

Andrew Smith

License

MIT Public License


All versions of views with dependencies

PHP Build Version
Package Version
Requires slim/slim Version >=2.4.0
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 slim/views contains the following files

Loading the files please wait ....