Download the PHP package netglue/revs without Composer

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

Filename Hashing Revisions & Automatic Cleanup

Continuous Integration

Probably re-inventing the wheel here, but I wanted to be able to rev front-end resource file names in a predictable way with options to automatically delete old revisions keeping either none of them or a specific number of the most recent ones. There are javascript tools that do this but at the time of writing, I couldn't find anything I liked in JS land that you could just fire off from an npm package script easily. There's plenty for Grunt and Gulp if you're using those.

The main use-case for this lib is to be triggered by a script in your package.json something like this:

Install with composer

In order to use the tools, make sure that you've required composers vendor/autoload.php, or use the shipped binary in vendor/bin/rev

Operation

Say you have a file in /my/frontend/whatever.css, and you want a hashed filename in /my/public/assets/{hashed-file-name}.css, you'd do something like this:

The options object can be fed an array like this:

By default, no old revisions will be deleted, so the revision count parameter is irrelevant. You must explicitly enable it.

Resulting File Names

Yeah, they’re pretty long because they are composed of original-filename-{md5 hash}-{UUID1}.extension - the file names include a time-based UUID so that an accurate time can be computed for the time the file was generated, hence being able to sort them and make sure we're deleting the oldest revisions when appropriate. It might make sense to get rid of the md5 hash, but that's what's used to determine whether the file has actually changed or not. If the hash hasn't changed between operations, the process is halted.

Removing old versions

Specifying a 'revision count' in options and setting cleanup to true will keep that many old versions in the target directory. So with a revision count of 1, you'd have the current and next most recent versions.

The return value of Revver::revFile() can tell you the paths of any deleted files if you're interested.

Replacement in Files…

Assuming you have some file that needs references to these 'revved' file names updating, you can use the return value of \Netglue\Revs\Revver::revFile() to perform replacement on a string, or in another file on disk, for example:

Putting it together

Assuming you have somehow received notification that your JS is built to a file located in /build/index.js and you want that copied to /public/assets with a revved file name and all the html files in /public to be updated with the new file name:

Symfony Command

Composer will create a binary in vendor/bin/rev after installation which you can call from build scripts. There’s straightforward help in the command itself so just issue vendor/bin/rev netglue:rev --help to get an overview of the options.

Test

cd to wherever the module is installed, issue a composer install followed by a composer check.

Contributions

PR's are welcomed. Please write tests for new features.

Support

You're welcome to file issues, but please understand that finding the time to answer support requests is very limited so there might be a long wait for an answer.

About

Netglue makes websites and apps in Devon, England. We hope this is useful to you and we’d appreciate feedback either way :)


All versions of revs with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2 || ~8.3 || ~8.4
ramsey/uuid Version ^4.7.0
symfony/console Version ^6.4.17 || ^7.2
webmozart/assert Version ^1.11
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 netglue/revs contains the following files

Loading the files please wait ....