Coder Social home page Coder Social logo

squeezer's Introduction

Squeezer

Author Build Status Coverage Status Quality Score Dependency Status

Latest Stable Version Total Downloads License

Squeezer is a minifier for php class files. It will parse your directories to find valid classes, interfaces and traits and squeeze them to one file. Autoloading in php is quite nice but also expensive. Sometimes too expensive for production. Using a minified file reduces the execution time of your application but increases the memory usage. Take care which directories or packages you want to squeeze. For production you should only squeeze used packages.

Installation

The recommended way to install mamuz/squeezer is through composer by adding dependency to your composer.json:

{
    "require-dev": {
        "mamuz/squeezer": "0.*"
    }
}

Features

  • Minify classes, interfaces and traits to one compressed file.
  • Validates availability of class dependencies.
  • Removing comments and docblocks is optional to keep interoperability to annotation parser.
  • PHP files with more than one class, interface or trait declarations will be skipped.
  • PHP files with include, include_once, require or require_once statements will be skipped.
  • PHP files with function calls to handle files like fopen or mkdirwill be skipped.
  • PHP files with a declare statement will be skipped.

Usage

Run this command line to squeeze your library without comments to classes.min.php:

./vendor/bin/squeeze classes.min.php --source="module/*/src, vendor/zendframework/*/src" --exclude="zend-loader" --nocomments

For instance, we are using a typical ZendFramework Application, but you can adapt this command to each environment

After that you can include classes.min.php inside your index.php, but before loading composer autoloader.

For instance...

//...
include_once 'classes.min.php';
include_once 'vendor/autoload.php'; // composer autoloader
//...

Use this command to get synopsis about all arguments

./vendor/bin/squeeze --help

squeezer's People

Contributors

mamuz avatar

Watchers

James Cloos avatar Alexei Kochetov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.