Download the PHP package aelvan/stamp without Composer

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

Stamp for Craft

A tiny plugin for adding timestamp to filenames.

This is the Craft 3.x version of Stamp, for the Craft 2.x version see the master branch.

Requirements

This plugin requires Craft CMS 3.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Then tell Composer to load the plugin:

    composer require aelvan/stamp
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Stamp.

Usage

Use it like this:

<script src="{{ craft.stamp.er('/assets/build/js/scripts.js') }}"></script> 

Which results in:

<script src="/assets/build/js/scripts.1399647655.js"></script>

The er() method takes a second parameter for setting the format of the output. Possible values are file (default), folder, query and tsonly.

Example with folder:

<script src="{{ craft.stamp.er('/assets/build/js/scripts.js', 'folder') }}"></script> 

Result:

<script src="/assets/build/js/1399647655/scripts.js"></script>

Example with query:

<script src="{{ craft.stamp.er('/assets/build/js/scripts.js', 'query') }}"></script> 

Result:

<script src="/assets/build/js/scripts.js?ts=1399647655"></script>

Example with only:

Timestamp is: {{ craft.stamp.er('/assets/build/js/scripts.js', 'only') }} 

Result:

Timestamp is: 1399647655

Hashing option

The craft.stamp.er() method takes a third parameter for setting the algorithm of the output. Possible values are ts (default), and hash.

ts stands for timestamp and behaves as shown above. hash gets the CRC32 checksum of the file instead of the timestamp. It's useful for cases when you need your cache busting to be fully deterministic.

For example:

<script src="{{ craft.stamp.er('/assets/build/js/scripts.js', 'file', 'hash') }}"></script>

Result:

<script src="/assets/build/js/scripts.2031312059.js"></script>

URL rewriting

For methods file and folder you probably want to do some url rewriting. Below are some examples of how this can be done, adjust as needed for your server and project setup.

Apache:

# Rewrites asset versioning, ie styles.1399647655.css to styles.css.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.(\d{10})\.(js|css)$ $1.$3 [L]  # /assets/build/js/scripts.1399647655.js
# RewriteRule ^(.+)/(\d{10})/(.+)\.(js|css)$ $1/$3.$4 [L]  # /assets/build/js/1399647655/scripts.js

nginx:

location @assetversioning {
    rewrite ^(.+)\.[0-9]+\.(css|js)$ $1.$2 last;  # /assets/build/js/scripts.1399647655.js
    # rewrite ^(.+)/([0-9]+)/(.+)\.(js|css)$ $1/$3.$4 last;  # /assets/build/js/1399647655/scripts.js
}    

location ~* ^/assets/.*\.(?:css|js)$ {
    try_files $uri @assetversioning;
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

Configuration

Stamp needs to know the public document root to know where your files are located. By default Stamp will use @webroot, but on some server configurations this is not the correct path. You can configure the path by creating a config file called stamp.php in your config folder, and adding the publicRoot setting.

Example

'publicRoot' => '/path/to/website/public/',

Changelog

See CHANGELOG.md.


All versions of stamp with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.0.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 aelvan/stamp contains the following files

Loading the files please wait ....