Minify JavaScript API with PHP

Minimize javascript from an url with the .Maui APIs in PHP is quick, easy and free.

You can choose between two compression levels: High, no readability, smallest size, or bass, higher readability. You can also save the minimized files to the .Maui CDN.

It is necessary to register at dotmaui.com to get the free api key. To run this example, the CURL library must be enabled.

<?php

$data = array('apikey' => 'YOUR_API_KEY', 
              'url' => "https://dotmaui.com/assets/js/global.js");

$curl = curl_init("https://api.dotmaui.com/client/1.0/jsmin/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 

$output = curl_exec($curl);  

curl_close($curl);

echo $output;

Leave a Comment

Your email address will not be published. Required fields are marked *