Download the PHP package dmeys/htmlmin without Composer

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

Laravel HTMLMin

Laravel HTMLMin is currently maintained by Raza Mehdi, and is a simple HTML minifier for Laravel. It utilises Mr Clay's Minify package to minify entire responses, but can also minify blade at compile time. Feel free to check out the contribution guidelines.

Tests Latest Version

Installation

Laravel HTMLMin requires PHP 5.5+. This particular version supports Laravel 5.1-5.8, 6.x, 7.x and 8.x.

To get the latest version, simply require the project using Composer:

Once installed, register the service provider in your config/app.php

If you want, a facade is available to alias

Configuration

Laravel HTMLMin supports optional configuration.

To get started, you'll need to publish all vendor assets:

This will create a config/htmlmin.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

There are three config options:

Automatic Blade Optimizations

This option ('blade') enables minification of the blade views as they are compiled. These optimizations have little impact on php processing time as the optimizations are only applied once and are cached. This package will do nothing by default to allow it to be used without minifying pages automatically. The default value for this setting is false.

Force Blade Optimizations

This option ('force') forces blade minification on views where there such minification may be dangerous. This should only be used if you are fully aware of the potential issues this may cause. Obviously, this setting is dependent on blade minification actually being enabled. The default value for this setting is false.

Ignore Blade Files

This option ('ignore') is where you can specify paths, which you don't want to minify. A sensible default for this setting is provided.

Usage

HTMLMin

This is the class of most interest. It is bound to the ioc container as 'htmlmin' and can be accessed using the Facades\HTMLMin facade. There are four public methods of interest.

The 'blade' method will parse a string as blade and minify it as quickly as possible. This is method the compiler class uses when blade minification is enabled.

The 'css' and 'js' methods will parse a string as css/js and will minify it using Mr Clay's Minify package.

The 'html' method will parse a string as html and will minify it as best as possible using Mr Clay's Minify package. It will also be able to minify inline css and js. This is the method that is used by the minification middleware.

Facades\HTMLMin

This facade will dynamically pass static method calls to the 'htmlmin' object in the ioc container which by default is the HTMLMin class.

Minifiers\MinifierInterface

This interface defines the public method a minifier class must implement. Such a class must only provide a 'render' method which takes one parameter as a string, and should return a string. This package ships with 4 implementations of this interface, but these classes are not intended for public use, so have no been documented here. You can see the source here.

Http\Middleware\MinifyMiddleware

You may put the HTMLMin\HTMLMin\Http\Middleware\MinifyMiddleware middleware in front of your routes to live minify them. Note that this middleware allows you to achieve maximal results, though at a performance cost because of it running on each request instead of once like the built in blade minification. It may be useful for you to take a look at the source for this, read the tests, or check out Laravel's documentation if you need to.

Skipping Minification

As well as being able to skip folders using the ('ignore') config, there are occasions where you will want to 'skip' single files.

Just add the following comment to each file you want to skip:

Please note that if you use ('force') option in the config it will not work.

HTMLMinServiceProvider

This class contains no public methods of interest. This class should be added to the providers array in config/app.php. This class will setup ioc bindings and register automatic blade minification based on the config.

Further Information

There are other classes in this package that are not documented here (such as the compiler class). This is because they are not intended for public use and are used internally by this package.

Please note to clear view cache to see changes.

Security

If you discover a security vulnerability within this package, please send an e-mail to Raza Mehdi at [email protected]. All security vulnerabilities will be promptly addressed.

License

Laravel HTMLMin is licensed under The MIT License (MIT).


All versions of htmlmin with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/contracts Version ^11.0
illuminate/filesystem Version ^11.0
illuminate/http Version ^11.0
illuminate/routing Version ^11.0
illuminate/support Version ^11.0
illuminate/view Version ^11.0
mrclay/minify Version ^2.2|^3.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 dmeys/htmlmin contains the following files

Loading the files please wait ....