Download the PHP package qtgye/wp-template-wrapper without Composer

On this page you can find all versions of the php package qtgye/wp-template-wrapper. 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 wp-template-wrapper

WP Template Wrapper

A better way to develop Wordpress templates.

Features

Organized Template Files

All the template files reside in the templates folder.
Any template files at the theme's root folder will not work


Template Slug

Template Wrapper transforms wordpress's default template file naming to provide better organization of the files.
'Slugged' template files, i.e. single-{post_type|post_name|post_id} etc., are grouped in a subdirectory named to that type.

Example:

In general, files are organized by {type}/{slug|id|custom-name}.php format.


Custom Page Templates

Custom page templates should be placed in the templates folder.

Template Wrapper uses custom page template files only for registration in the admin.
That is, custom page template files will not be used as "views".
You have to create a file of the same name in the templates/page folder.

Example:

To use a custom "Donate Page Template" using custom-donate-page.php,
Create one in the page-templates folder as a registry, containing only the template name.
Create another one in the templates/page folder as a "view". This will be the one rendering your view.

Template Based Routing

Template Wrapper allows route registration through template_routes hook.
Routes are placed in src/routes.php in the following manner:

$template_slug (String)

The "route" to the template slug. This is similar to the Wordpress's template hierarchy, though transformed to become directory-based.

$callable (Function or Object/Class Method)

The "controller". This will handle the data passed to the template. This can be either a function or an object/class method, similar to MVC approach.


Example:

Note:
A "slugged" route doesnt require a template counterpart. Just like wordpress's template hierarchy, it will use the available template for that slug. That is, a page/about route will use templates/page.php if templates/page/about.php is not available.

Template Wrapper

This is inspired by scribu's theme wrapper which also implemented in Sage starter themes.
It allows you to have your main layout in wrapper.php, and the main template will be automatically wrapped with it. It prevents code repition caused by using get_header() or get_footer() at each main template.

Template Includes

The Template Wrapper provides a way to include templates and passing data through include_template method of the Wrapper class.

To avoid having to declare Wrapper's namespace in every template, it is recommended to wrap it in a global function instead, like so:

$template_slug (String)

The slug of the template file relative to the templates folder. In the example, it will load templates/modules/content.php.

$data (Assoc. Array)

The data to be passed into the included template. Note that user-defined globals are also available in the included templates, so if there are common variable names, the template data will override it.

Template Data

The route callable handles the data being passed to the template. Through reflection, the callable may receive user-defined globals as arguments.

Example:


Global Data

The user-defined global data is defined in the src/global.php through the template_global_data hook. These globals are available within templates.

Example:

Template Wrapper provides pre-defined globals to which user-defined globals are merged:
$wp, $wpdb, $wp_query, $post, $authordata, $page;

AJAX Routes

Template Wrapper provides a way to handle ajax routing using action.

Register ajax routes through the ajax_routes hook.

Within the ajax callback, GET parameters and user-defined globals are passed through reflection.



TODOs:


All versions of wp-template-wrapper with dependencies

PHP Build Version
Package Version
No informations.
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 qtgye/wp-template-wrapper contains the following files

Loading the files please wait ....