Download the PHP package wilycode/template-assets without Composer

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

WilyCode Template Assets

PHP 8.4+ Tests

Page-scoped CSS and JavaScript asset collection for WilyCode Template, with development cache busting and production bundling.

WilyCode PHP Ecosystem

This library is part of WilyCode, a collection of independent PHP components. Each package has its own repository, Composer installation and releases.

Explore the WilyCode ecosystem →

Requirements

Installation

Quick start

Register the extension on an existing TemplateEngine:

publicBasePath points to the web-accessible directory and must exist. By default, generated production files go into public/assets/build and are referenced by /assets/build/....

In your .tpl file, declare the assets your page needs:

In a layout, emit the collected tags at the desired positions:

The @css(...) and @js(...) directives register files without rendering tags. The @renderCss() and @renderJs() directives output the tags. The extension also shares the Assets collector as $assetManager, without overwriting WilyApp's separate $assets view variable.

Asset modes

Mode Behavior
AssetMode::Development Keep each file separate. Append ?v=<filemtime> to existing local files. Preserve existing query strings and URL fragments.
AssetMode::Production Minify and combine contiguous runs of existing local CSS/JS files into bundles under /assets/build. The filename incorporates a SHA-256 fingerprint of each source's contents and URL path.

Both modes preserve declaration order, omit exact duplicate URL registrations, and escape generated HTML attributes.

Remote URLs (including protocol-relative URLs) remain separate, and the public base URL is not prepended to them. Missing local files also remain separate rather than causing a build failure. Remote or missing files split a production bundle into separate local runs, preserving ordering between dependencies.

CSS relative paths: The minifier receives a target file path so that it can rewrite relative URLs for the build directory. Test any CSS imports, fonts, and images used by your project before deployment. Bundle fingerprints reflect the registered CSS source files, not the contents of files imported or embedded by the minifier; if those dependencies change independently, rebuild assets and invalidate external caches as part of deployment.

Additional options

Lifecycle

An Assets instance collects declarations until it is no longer used. Create a fresh collector for each request or independently rendered page to avoid carrying registrations between pages. In a long-running server, do not share the same mutable collector across unrelated requests.

API

Method / template function Purpose
addCss(string $path) / @css(...) Register CSS once, in order.
addJs(string $path) / @js(...) Register JavaScript once, in order.
renderCss() / @renderCss() Generate CSS links or production bundles.
renderJs() / @renderJs() Generate script tags or production bundles.

Development

The test suite covers output ordering, external assets, source fingerprints, path safety, and integration with wilycode/template. GitHub Actions runs it on PHP 8.4.

Development-only directories such as tests/ and .github/ are omitted from the usual Composer dist archive; they remain available in the Git repository. A --prefer-source Git checkout includes them.

License

MIT — see LICENSE.


All versions of template-assets with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
matthiasmullie/minify Version ^1.3
wilycode/template Version ^0.1
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 wilycode/template-assets contains the following files

Loading the files please wait ...