Download the PHP package knifelemon/comment-template without Composer

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

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

CommentTemplate

A powerful PHP template engine with asset compilation, template inheritance, and variable processing. CommentTemplate provides a simple yet flexible way to manage templates with built-in CSS/JS minification and caching.

Features

Installation

Install via Composer:

Quick Start

Basic Usage

Flight Framework Integration

Method 1: Using Callback (Recommended)

Method 2: Using Constructor Parameters

Template Directives

Asset Loading Strategies

CommentTemplate supports different JavaScript loading strategies:

Layout Inheritance

Use layouts to create a common structure:

layout.php:

page.php:

Asset Management

CSS Files

JavaScript Files

Wildcard Support:

Priority Ordering:

All asset directives (@css, @cssSingle, @js, @jsAsync, @jsDefer, @jsTop, @jsTopAsync, @jsTopDefer, @jsSingle, @jsSingleAsync, @jsSingleDefer) support optional priority ordering by adding a number after the file path:

Priority rules:

Cache Busting

Enable cache busting to append a timestamp query string (?{filemtime}) to compiled asset URLs. This forces browsers to reload assets when files are updated.

Output comparison:

Works with all asset types: @css, @cssSingle, @js, @jsAsync, @jsDefer, @jsTop, @jsTopAsync, @jsTopDefer, @jsSingle, @jsSingleAsync, @jsSingleDefer.

Base64 Encoding

Asset Copying

Asset Directives in CSS/JS Files

CommentTemplate also processes asset directives within CSS and JavaScript files during compilation:

CSS Example:

JavaScript Example:

Benefits:

PHP Code Execution

Execute PHP code and output the result using <!--@echo()-->:

In JavaScript files:

In CSS files:

Features:

Important Notes:

Path Configuration

CommentTemplate provides intelligent path handling for both relative and absolute paths:

Public Path

The Public Path is the root directory of your web application, typically where index.php resides. This is the document root that web servers serve files from.

Templates Path Configuration

Templates path supports both relative and absolute paths:

Asset Path Configuration

Asset path also supports both relative and absolute paths:

Smart Path Detection:

How it works:

Asset Directory Copying Examples

Directory structure example:

Template Includes

Variable Processing

Variable Filters

Variable Commands

Chain Multiple Filters

Example:

Comments

Template comments are completely removed from the output and won't appear in the final HTML:

Note: Template comments {* ... *} are different from HTML comments <!-- ... -->. Template comments are removed during processing and never reach the browser.

API Reference

Engine Class

Constructor

Methods

render(string $template, array $data = []): void

fetch(string $template, array $data = []): string

setPublicPath(string $path): void

setSkinPath(string $path): void

setFileExtension(string $extension): void

setAssetPath(string $path): void

setCacheBusting(bool $enabled): void

getPublicPath(): string

getSkinPath(): string

getFileExtension(): string

getAssetPath(): string

getCacheBusting(): bool

This will:

  1. Minify and combine CSS files
  2. Minify and combine JS files
  3. Cache compiled assets
  4. Inject <link> and <script> tags automatically

Development

Running Tests

Code Analysis

Test Coverage

Tracy Debugger Integration

CommentTemplate includes integration with Tracy Debugger for development logging and debugging.

Comment Template Tracy

Installation

Usage

Debug Panel Features

CommentTemplate adds a custom panel to Tracy's debug bar with four tabs:

What Gets Logged

Note: Zero performance impact when Tracy is not installed or disabled.

See examples/tracy/ and examples/flightphp/ for complete working examples.

License

MIT License. See LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Support


All versions of comment-template with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
matthiasmullie/minify Version ^1.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 knifelemon/comment-template contains the following files

Loading the files please wait ...