Download the PHP package requtize/fresh-file without Composer

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

FreshFile

Simple, fast, standalone PHP library, that helps You to define, if any of your files were modified since last time You check - Is this file FRESH?

Script uses filemtime() function (with optional clearstatcache()) to get last modification time of file. All modification times are stored in one cache file (if You use multiple instances, multiple files will be created), so even when you use this library for houndreds of files, it will store their times in one file, and read&write of cache file will be done one time per request.

Usage

You can create many instances as You want, or create one, and use it as dummy-singleton accessed by static method of class. As argument You must pass a valid cache filepath, where script can place it's metadata cache.

Once created You can use Your object anywhere You pass it, or get the existend object from static call.

In first solution You must pass this object anywhere You want use it. In second solution You have to create object one time, and You can use it anywhere You want without passing it as argument.

Prevent save cache on object destroy

FreshFile saves metadata file when FreshFile object destroy (when PHP script/request ends), by default. But in some cases You may need to prevent this. Maybe there was some error in Your code and You won't save the current collected data in cache? To do this, pass the second argument as false to prevent this. From now, You must manually close the FreshFile and save the metadata collected in the request by using close() method.

Remember!

If You have prevented save on destroy, You must always close the FreshFile object after Your script ends!

Use case

You can check one or many files at one time. If You pass array of filepaths, and any of files will not be fresh (even 1 from 100), method returns true - which means file is fresh and some operations with this file need to be done.

If You check if the file is fresh, script automatically updates metadata for this file, and next time You ask object if the same file is fresh, script returns false - that means this file do not need to be updated. Even when you call again line by line in the same script/request!!

Related files

You can define related files of one main file. This is usefull when You compile LESS or SCSS files with imports, create imports in configuration files, etc. Once passed related files, script will check also if these related files are fresh. If main file or any of related files will change, You will be noticed.

You can also set related files, after first fresh-check. This can be usefull when You detect, if any of these files was modified, and You want to update related files for this file.

Licence

This code is licensed under MIT License.


All versions of fresh-file with dependencies

PHP Build Version
Package Version
Requires php Version ~5.5 || ~7.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 requtize/fresh-file contains the following files

Loading the files please wait ....