PHP code example of oriceon / minify

1. Go to this page and download the library: Download oriceon/minify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oriceon / minify example snippets

 artisan vendor:publish --provider="Oriceon\Minify\MinifyServiceProvider" --force

	// app/views/hello.blade.php

	<html>
		<head>
			...
			{!! Minify::stylesheet('/css/main.css') !!}

			// or by passing multiple files
			{!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css')) !!}

			// add custom attributes
			{!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'), array('foo' => 'bar')) !!}

			// add full uri of the resource
			{!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'))->withFullUrl() !!}
		    {!! Minify::stylesheet(array('//fonts.googleapis.com/css?family=Roboto')) !!}

			// minify and combine all stylesheet files in given folder
			{!! Minify::stylesheetDir('/css/') !!}

			// add custom attributes to minify and combine all stylesheet files in given folder
			{!! Minify::stylesheetDir('/css/', array('foo' => 'bar', 'defer' => true)) !!}

			// minify and combine all stylesheet files in given folder with full uri
			{!! Minify::stylesheetDir('/css/')->withFullUrl() !!}
		</head>
		...
	</html>


	// app/views/hello.blade.php

	<html>
		<body>
		...
		</body>
		{!! Minify::javascript('/js/jquery.js') !!}

		// or by passing multiple files
		{!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js')) !!}

		// add custom attributes
		{!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'), array('bar' => 'baz')) !!}

		// add full uri of the resource
		{!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'))->withFullUrl() !!}
        {!! Minify::javascript(array('//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js')) !!}

		// minify and combine all javascript files in given folder
		{!! Minify::javascriptDir('/js/') !!}

		// add custom attributes to minify and combine all javascript files in given folder
		{!! Minify::javascriptDir('/js/', array('bar' => 'baz', 'async' => true)) !!}

		// minify and combine all javascript files in given folder with full uri
		{!! Minify::javascriptDir('/js/')->withFullUrl() !!}
	</html>