Download the PHP package nette/assets without Composer

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

Nette Assets

Downloads this Month Tests Latest Stable Version License

 <!---->

Introduction

Nette Assets is a powerful asset management library for PHP that helps you:

✅ organize and serve your static assets (images, CSS, JavaScript, audio, etc.)
✅ handle asset versioning automatically
✅ get image dimensions without hassle
✅ verify asset existence
✅ support multiple storage backends
✅ integrate with Vite for modern frontend development

The library provides a clean and intuitive API to manage static assets in your web applications with a focus on developer experience and performance.

 <!---->

Installation and Requirements

The recommended way to install is via Composer:

Nette Assets requires PHP 8.1 or higher.

 <!---->

Core Concepts

The library revolves around a few key components:

 <!---->

Asset Types

The library provides specialized asset interfaces and implementations for different content types:

 <!---->

Configuration

Configuration is typically done in your application's NEON configuration file under the assets key.

You can define a base filesystem path and URL prefix under the main assets: key. These serve as the foundation from which relative paths defined in mappers are resolved.

However, explicit configuration is often optional. If omitted, path typically defaults to your public web root (%wwwDir%), and url defaults to the application's base URL path (for example https://domain/).

The mapping section defines your named mappers. Each key in mapping is a mapper identifier (e.g., default, audio, images). Now, let's see how different mapper configurations under mapping behave relative to the base settings:

 <!---->

Extension Autodetection

The mapper can automatically handle file extensions if the reference doesn't include one. You configure this using the extension option within a mapper's definition.

 <!---->

Using Custom Mappers

By default, the configurations in the mapping section implicitly create instances of the built-in Nette\Assets\FilesystemMapper. If FilesystemMapper doesn't fit your needs (e.g., you need to load assets from a database, S3, or read a manifest file generated by build tools like Vite or Webpack), you can provide an instance of your own class implementing Nette\Assets\Mapper:

 <!---->

Retrieving Assets

Retrieve assets via the Registry service, typically injected where needed. The main method is getAsset():

 <!---->

Usage in Latte

Assuming Latte helper asset is registered to call the Registry:

The resulting URL string obtained from $asset->url or {asset(...)} will include versioning information if provided by the mapper.

 <!---->

Asset Versioning

The built-in FilesystemMapper supports asset versioning. By default, it automatically appends a version query parameter based on the file's last modification time (filemtime):

generates, for example:

This helps with browser cache invalidation. Custom mappers can implement different versioning strategies (e.g., using content hashes from a build manifest).

You can disable versioning per asset:

Or in configuration file:

 <!---->

Image Dimensions

When using FilesystemMapper (or any mapper returning a FileAsset), you can easily retrieve image dimensions (assuming corresponding Latte helpers are registered):

FileAsset provides $duration property for estimating MP3 duration (most reliable for Constant Bitrate files).

Entry Points and Bundle Support

Nette Assets supports modern bundlers and build tools that generate multiple files from a single entry point:

Vite Integration

Vite integration automatically handles:

Usage in Latte Templates


All versions of assets with dependencies

PHP Build Version
Package Version
Requires php Version 8.1 - 8.4
nette/utils Version ^4.0.6
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 nette/assets contains the following files

Loading the files please wait ....