Download the PHP package megaoptim/megaoptim-php without Composer

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

MegaOptim

MegaOptim provides REST based APIs for optimizing images while keeping them almost identical to the original image but significantly reducing the image size using its advanced algorithms.

The end result is to satisfy the pagespeed requirements, fast website load, less space usage, etc.

This library can be installed with composer or without composer and can be used in differet use cases such as optimizing your library, optimizing the uploaded image on the go, etc.

Requirements

Installation

Composer

You can install it with composer

Without Composer

This is not recommended way. But you can require the loadnoncomposer.php file that will load the library without composer.

How to Use

This library has a class that will be used in 99% of the usecases and it is called and the method is the method used for optimization. Its definition is as follows:

    • string|array The resources path, can be: Single image path OR Single URL OR multiple local paths OR multiple urls in array. But not mixed array of urls and paths.
    • array The parameters that describe how the optimization is going to be. It has few properties:
      • 1 OR 0
      • Numeric px value
      • Numeric px value
      • 1 OR 0
      • intelligent (default), ultra OR lossless
      • 1 OR 0 (generate or don't generate webp)

The parameter is not required and the defaults are as follows:

To optimize single image call the method on some given parameters just like the following examples:

Single Local File

Single URL

Multiple Files ( up to 5 )

Multiple URLs ( up to 5 )

Handling Response

Once we run the optimization with run() method we have the instance of MegaOptim\Http\Response which contains all the response variables and array of optimized image objects.

The contents of the methods are as follows:

To get the optimized image objects and further process them we can use the getOptimizedFiles() method which will return array as mentioned above:

We have the following properties and methods available to use for each optimized image object:

To save the optimized images locally we have three methods available:

TODO

Development

If you found a bug or want to contribute to the script feel free to create pull requests to make it even better!

License


All versions of megaoptim-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.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 megaoptim/megaoptim-php contains the following files

Loading the files please wait ....