Download the PHP package orkhanahmadov/laravel-zip-validator without Composer

On this page you can find all versions of the php package orkhanahmadov/laravel-zip-validator. 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 laravel-zip-validator

Laravel ZIP file validator

Buy us a tree Latest Stable Version Latest Unstable Version Total Downloads GitHub license

Build Status Test Coverage Maintainability Quality Score StyleCI

Custom Laravel validation rule for checking ZIP file content.

Requirements

Installation

You can install the package via composer:

Usage

Use ZipContent rule with list of required files.

Pass list of required files/folders to the constructor of the validator.

You can pass files as different constructor arguments or as array. If files are nested inside folders, pass relative path to file.

Validator will fail if any of the passed files does not exist in ZIP archive.

Validating maximum file size

Validator also allows checking maximum size of each file inside ZIP archive.

Simply pass file name as array key and maximum size as value:

Validator in above example will look for thumb.jpg file with maximum size of 100000 bytes (100KB).

You can also mix multiple files with name-only or name+size validation:

Multiple files with "OR" validation

You can also pass multiple files with | symbol, if any of them exist in ZIP file validator will succeed.

Validator in above example will look if thumb.jpg or thumb.png or thumb.svg file exists in ZIP.

Of course, you can also validate file size with "OR" validation:

Above example will look if thumb.jpg or thumb.png file exists in ZIP and its file size is not bigger than 100000 bytes (100KB).

Important to keep in mind that when using "OR" validation with additional file size validation, validator will compare file size with the first matching element in ZIP archive.

Rejecting empty files

By default, validator only checks if file with given name exists, it will return true even if file with matching name is empty (has size of 0 bytes).

You can pass array of files as first argument and false as second argument to constructor if you want validator to reject files with 0 bytes.

Wildcard filename matching

Additionally, you can use wildcard filename matching with * symbol.

This will return true if Zip archive contains any file with .jpg extension.

Filename matching is using fnmatch function. You can use any of its patterns.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-zip-validator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-zip Version *
illuminate/contracts Version ^9.0|^10.0
illuminate/support Version ^9.0|^10.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 orkhanahmadov/laravel-zip-validator contains the following files

Loading the files please wait ....