:clamp: HtmlMin: HTML Compressor and Minifier via PHP

Overview

Build Status Coverage Status Codacy Badge Latest Stable Version Total Downloads License Donate to this project using Paypal Donate to this project using Patreon

🗜️ HtmlMin: HTML Compressor and Minifier for PHP

Description

HtmlMin is a fast and very easy to use PHP library that minifies given HTML5 source by removing extra whitespaces, comments and other unneeded characters without breaking the content structure. As a result pages become smaller in size and load faster. It will also prepare the HTML for better gzip results, by re-ranging (sort alphabetical) attributes and css-class-names.

Install via "composer require"

composer require voku/html-min

Quick Start

use voku\helper\HtmlMin;

$html = "
<html>
  \r\n\t
  <body>
    <ul style=''>
      <li style='display: inline;' class='foo'>
        \xc3\xa0
      </li>
      <li class='foo' style='display: inline;'>
        \xc3\xa1
      </li>
    </ul>
  </body>
  \r\n\t
</html>
";
$htmlMin = new HtmlMin();

echo $htmlMin->minify($html); 
// '<html><body><ul><li class=foo style="display: inline;"> à <li class=foo style="display: inline;"> á </ul>'

Options

use voku\helper\HtmlMin;

$htmlMin = new HtmlMin();

/* 
 * Protected HTML (inline css / inline js / conditional comments) are still protected,
 *    no matter what settings you use.
 */

$htmlMin->doOptimizeViaHtmlDomParser();               // optimize html via "HtmlDomParser()"
$htmlMin->doRemoveComments();                         // remove default HTML comments (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doSumUpWhitespace();                        // sum-up extra whitespace from the Dom (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doRemoveWhitespaceAroundTags();             // remove whitespace around tags (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doOptimizeAttributes();                     // optimize html attributes (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doRemoveHttpPrefixFromAttributes();         // remove optional "http:"-prefix from attributes (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveHttpsPrefixFromAttributes();        // remove optional "https:"-prefix from attributes (depends on "doOptimizeAttributes(true)")
$htmlMin->doKeepHttpAndHttpsPrefixOnExternalAttributes(); // keep "http:"- and "https:"-prefix for all external links 
$htmlMin->doMakeSameDomainsLinksRelative(['example.com']); // make some links relative, by removing the domain from attributes
$htmlMin->doRemoveDefaultAttributes();                // remove defaults (depends on "doOptimizeAttributes(true)" | disabled by default)
$htmlMin->doRemoveDeprecatedAnchorName();             // remove deprecated anchor-jump (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedScriptCharsetAttribute(); // remove deprecated charset-attribute - the browser will use the charset from the HTTP-Header, anyway (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedTypeFromScriptTag();      // remove deprecated script-mime-types (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedTypeFromStylesheetLink(); // remove "type=text/css" for css links (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedTypeFromStyleAndLinkTag(); // remove "type=text/css" from all links and styles
$htmlMin->doRemoveDefaultMediaTypeFromStyleAndLinkTag(); // remove "media="all" from all links and styles
$htmlMin->doRemoveDefaultTypeFromButton();            // remove type="submit" from button tags 
$htmlMin->doRemoveEmptyAttributes();                  // remove some empty attributes (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveValueFromEmptyInput();              // remove 'value=""' from empty <input> (depends on "doOptimizeAttributes(true)")
$htmlMin->doSortCssClassNames();                      // sort css-class-names, for better gzip results (depends on "doOptimizeAttributes(true)")
$htmlMin->doSortHtmlAttributes();                     // sort html-attributes, for better gzip results (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveSpacesBetweenTags();                // remove more (aggressive) spaces in the dom (disabled by default)
$htmlMin->doRemoveOmittedQuotes();                    // remove quotes e.g. class="lall" => class=lall
$htmlMin->doRemoveOmittedHtmlTags();                  // remove ommitted html tags e.g. <p>lall</p> => <p>lall 

PS: you can use the "nocompress"-tag to keep the html e.g.: "\n foobar \n"

Unit Test

  1. Composer is a prerequisite for running the tests.
composer install voku/html-min
  1. The tests can be executed by running this command from the root directory:
./vendor/bin/phpunit

Support

For support and donations please visit Github | Issues | PayPal | Patreon.

For status updates and release announcements please visit Releases | Twitter | Patreon.

For professional support please contact me.

Thanks

  • Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
  • Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  • Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
  • Thanks to StyleCI for the simple but powerfull code style check.
  • Thanks to PHPStan && Psalm for relly great Static analysis tools and for discover bugs in the code!
Comments
  • HtmlMin cut html at the end of page

    HtmlMin cut html at the end of page

    opened by Fantella1978 12
  • v3 unexpected whitespace removal

    v3 unexpected whitespace removal

    Before compression:

    
                            <span>foo</span>
                                                        <a href="bar">baz</a>
                                        <span>bat</span>
    

    After compression:

    <span>foo</span><a href=bar>baz</a><span>bat</span>
    

    Notice that all whitespace has been removed, even though there was whitespace between <span> and <a> elements in the source. This is invalid because it changes the way content is displayed after compression.

    opened by Bilge 8
  • <p> paragraphs break when compressing, closing tag missing

    paragraphs break when compressing, closing tag missing

    What is this bug about (expected vs actual behaviour)?

    expected: closing tag of a paragraph should still exist in HTML output after compressing:

    actual: closing tag is removed after compression

    How can I reproduce it?

    use voku\helper\HtmlMin;
    
    $html = "
    <p>
        This is a simple test to show compressing paragraphs does not work.
        #compressing html
    </p>
    ";
    $htmlMin = new HtmlMin();
    echo $htmlMin->minify($html);
    

    output: <p> This is a simple test to show compressing paragraphs does not work. #compressing html

    Does it take minutes, hours or days to fix?

    not sure

    Any additional information?

    It also affects https://github.com/voku/html-compress-twig

    wait for response 
    opened by posido 7
  • Vanishing closing tag

    Vanishing closing tag

    What is this feature about (expected vs actual behaviour)?

    Some closing tags are vanishing. In my example, the </p> is suddenly gone.

    string(94) "<div class=rating><p style="margin: 0;"><span style="width: 100%;"></span>  (2 reviews) </div>"
    

    How can I reproduce it?

    $html = '
    <div class="rating">
        <p style="margin: 0;">
            <span style="width: 100%;"></span>
        </p>
    
        (2 reviews)
    </div>
    ';
    
    $htmlMin = new voku\helper\HtmlMin();
    $result = $htmlMin->minify($html);
    
    var_dump($result);
    

    Does it take minutes, hours or days to fix?

    Dunno.

    Any additional information?

    Using voku/html-min 4.3.0 and voku/simple_html_dom 4.7.14.

    opened by ozupey 7
  • keep prefix on non-resources + make domain local

    keep prefix on non-resources + make domain local

    Followup to discussion on #43

    Proposed Changes

    • Allow keeping of http/https prefix on href/non-rescource links.
    • Add option to make all same-domain links relative.
    • Add option to set domain manually

    Notes

    • makeSameDomainLinksRelative() disregards isKeepPrefixOnExternalAttributes(). This can be easily changed. The logic being that a library user choosing LinksRelative expects it to apply to both resources and links. Which is not the same expectation of choosing KeepPrefixOnExternal - which is to keep outgoing information intact.
    • Setting domain manually allows running HtmlMin without strong coupling of HtmlMin and $_SERVER

    This change is Reviewable

    opened by abuyoyo 7
  • `KeepPrefixOnExternal` fix and `sameDomainLinksRelative` API clean-up

    `KeepPrefixOnExternal` fix and `sameDomainLinksRelative` API clean-up

    Hi, I made some changes and a fix to previous PR #44 in light of removal of $_SERVER usage.

    Proposed Changes

    • KeepPrefixOnExternal does not affect link tags' href attribute. The link tag is not an external link. It's a resource that must adhere to removePrefix.
    • makeSameDomainLinksRelative() accepts $localDomain string as parameter
    • Removed method setLocalDomain() - functionality merged into makeSameDomainLinksRelative()
    • Removed unnecessary call to setLocalDomain() with empty parameter It is up to user to provide a valid localDomain string.

    This change is Reviewable

    opened by abuyoyo 6
  • PRCE error handling

    PRCE error handling

    On a legacy project, I'm facing issues with some client who (I don't really know how) has inserted base64 encoded images.

    Further more, those images aren't optimized at all (uncompressed PNG for photos...), resulting in huge base64 strings (multiple images up to 2mo):

    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA7EAAAJyCAYAAAFlL3dhAAAAAXNSR0IArs4c6QAAAARnQU1B....." />
    <!-- base64 string is shortened for clarity 😅  -->
    

    What is this feature about (expected vs actual behaviour)?

    When minifying such HTML, I end up with an empty string because this replacement fails: https://github.com/voku/HtmlMin/blob/4f700584abd70b308b7d06b8e4cfcc31711faaf9/src/voku/helper/HtmlMin.php#L1375-L1381

    Because it exceeds the pcre.backtrack-limit and returns a PREG_BACKTRACK_LIMIT_ERROR.

    I'm fully aware this is all wrong: wrong image format for photo and more importantly, large images sources should be inserted as URLs.

    However, technically speaking, all this crap is still valid HTML (the page displays when unminified) and I think such cases (even if it's kind of an edge case) should not fail.

    Thus, I wonder if a sanity check should be inserted somewhere to prevent the script from failing and returning an empty string? Maybe catch errors on all preg_ calls and return the unminified HTML if an error occured? Or check the string length against the pcre.backtrack-limit value?

    Wrapping preg_ calls the Guzzle json_decode way could be a nice solution (because it would not only handle backtrack-limit errors but all kinds of preg_ errors)? https://github.com/guzzle/guzzle/blob/74ca2cb463a7a99a0b99f195ca809cc4ba6c3147/src/Utils.php#L281-L301

    try {
        $html = (string) Utils::preg_replace_callback(
            '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#',
            static function ($matches) {
                return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>';
            },
            $html
        );
    } catch (\Exception $e) {
        return $html;
    }
    

    What do you think?

    How can I reproduce it?

    Try to minify some HTML with length that exceeds the pcre.backtrack-limit.

    Does it take minutes, hours or days to fix?

    I think a couple hours should be enough, I can submit a PR but would like your feedback on the different proposed solutions before working something out.

    opened by nlemoine 5
  • html tag for AMP is modifed incorrectly

    html tag for AMP is modifed incorrectly

    What is this feature about (expected vs actual behaviour)?

    To use AMP properly, one has to use a specific html tag <html ⚡>

    unfortunately HtmlMin removed the important bit, leaving only <html>

    How can I reproduce it?

    run the minifier over a sample document with the tag sahown above

    Does it take minutes, hours or days to fix?

    depending on the source of the problem and how much you are into your code: hours to days

    Any additional information?

    opened by scones 5
  • Upgrade code to work in PHP8 or greater and/or Laravel 9 or greater

    Upgrade code to work in PHP8 or greater and/or Laravel 9 or greater

    Fixes https://github.com/voku/HtmlMin/issues/84

    This repo doesn't work in PHP 8, 8.1 or 8.2 due to the namespaces not being Capitalized.

    • Have updated the namespaces.
    • Have updated composer.json and removed php 7 as security updates ended in 28 November 2022.
    • Have updated readme with new namespaces

    Need to update the connecting repos now.

    Linked to Pull Requests

    https://github.com/voku/html-compress-twig/pull/5

    https://github.com/voku/HtmlMin/pull/85

    https://github.com/voku/simple_html_dom/pull/95

    https://github.com/voku/simple-cache/pull/30

    https://github.com/voku/portable-ascii/pull/87

    Tested on the following

    Tested on PHP 8.2 and Laravel 9.1


    This change is Reviewable

    opened by summercms 4
  • Configure WhiteSource Bolt for GitHub

    Configure WhiteSource Bolt for GitHub

    Welcome to WhiteSource Bolt for GitHub! This is an onboarding PR to help you understand and configure settings before WhiteSource starts scanning your repository for security vulnerabilities.

    :vertical_traffic_light: WhiteSource Bolt for GitHub will start scanning your repository only once you merge this Pull Request. To disable WhiteSource Bolt for GitHub, simply close this Pull Request.


    What to Expect

    This PR contains a '.whitesource' configuration file which can be customized to your needs. If no changes were applied to this file, WhiteSource Bolt for GitHub will use the default configuration.

    Before merging this PR, Make sure the Issues tab is enabled. Once you merge this PR, WhiteSource Bolt for GitHub will scan your repository and create a GitHub Issue for every vulnerability detected in your repository.

    If you do not want a GitHub Issue to be created for each detected vulnerability, you can edit the '.whitesource' file and set the 'minSeverityLevel' parameter to 'NONE'.


    :question: Got questions? Check out WhiteSource Bolt for GitHub docs. If you need any further assistance then you can also request help here.


    This change is Reviewable

    opened by mend-bolt-for-github[bot] 4
  • Whitespaces before <strong> tag are removed, giving incorrect rendering

    Whitespaces before tag are removed, giving incorrect rendering

    What is this feature about (expected vs actual behaviour)?

    Whitespaces before <strong> tags are removed, giving incorrect rendering :

    image

    How can I reproduce it?

    Try to minify the following code :

    <!DOCTYPE html>
    <html lang="fr">
    <head><title>Test</title></head>
    <body>
    <p>Visitez notre boutique <strong>eBay</strong> : <a href="https://stores.ebay.fr/CAFE-RACER-OLD-SPARES" target="_blank">https://stores.ebay.fr/CAFE-RACER-OLD-SPARES</a></p>
    <p><strong>ID Vintage</strong>, spécialiste de la vente de pièces et accessoires pour motos tout- terrain classiques :<a href="https://id-vintage.com" target="_blank">https://id-vintage.com</a></p>
    <p>Magazine <strong>Café-Racer</strong> : <a href="https://www.cafe-racer.fr" target="_blank">https://www.cafe-racer.fr</a></p>
    <p><strong>Julien Lecointe</strong> : <a href="https://julien-lecointe.blogspot.com" target="_blank">https://julien-lecointe.blogspot.com</a></p>
    </body>
    </html>
    

    Does it take minutes, hours or days to fix?

    Not sure

    Any additional information?

    Using version 3.1.30 installed with composer on PHP 7.1

    Thanks !

    wait for response 
    opened by roadster31 4
  • Update actions/cache action to v3.0.8

    Update actions/cache action to v3.0.8

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/cache | action | patch | v3.0.5 -> v3.0.8 |


    Release Notes

    actions/cache

    v3.0.8

    Compare Source

    What's Changed
    • Fix zstd not working for windows on gnu tar in issues.
    • Allow users to provide a custom timeout as input for aborting cache segment download using the environment variable SEGMENT_DOWNLOAD_TIMEOUT_MIN. Default is 60 minutes.

    v3.0.7

    Compare Source

    What's Changed

    • Fix for the download stuck problem has been added in actions/cache for users who were intermittently facing the issue. As part of this fix, new timeout has been introduced in the download step to stop the download if it doesn't complete within an hour and run the rest of the workflow without erroring out.

    v3.0.6

    Compare Source

    What's Changed
    New Contributors

    Full Changelog: https://github.com/actions/cache/compare/v3...v3.0.6


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.


    This change is Reviewable

    opened by renovate[bot] 4
  • Broken script template tags

    Broken script template tags

    What is this feature about (expected vs actual behaviour)?

    The script below produces this:

    ____simple_html_dom__voku__html_special_script____ id="foo" type="text/html"> <tr><td colspan=5>  <script id="bar" type="text/html"> foo
    

    How can I reproduce it?

    $html = '<script id="foo" type="text/html">
    	<tr>
    		<td colspan="5">
    
    		</td>
    	</tr>
    </script>
    
    <script id="bar" type="text/html">
    	foo
    </script>';
    
    $htmlMin = new \voku\helper\HtmlMin();
    echo $htmlMin->minify($html); 
    

    Does it take minutes, hours or days to fix?

    Hopefully minutes.

    opened by ozupey 2
  • Unexpected whitespace removal before anchor tag

    Unexpected whitespace removal before anchor tag

    Input HTML: Get a <strong>complimentary</strong> organic lawn fertilizer with a lawn maintenance or bi-weekly subscription.<strong> <a href="https://domain.com/qgq8/contact-us">Contact us to schedule!</a></strong>

    Expected output: Get a <strong>complimentary</strong> organic lawn fertilizer with a lawn maintenance or bi-weekly subscription<strong> <a href="https://domain.com/qgq8/contact-us">Contact us to schedule!</a></strong>

    Actual output: Get a <strong>complimentary</strong> organic lawn fertilizer with a lawn maintenance or bi-weekly subscription.<strong><a href="https://domain.com/qgq8/contact-us">Contact us to schedule!</a></strong>

    Happens regardless of doOptimizeViaHtmlDomParser, doSumUpWhitespace, doRemoveWhitespaceAroundTags, doRemoveSpacesBetweenTags settings.

    opened by jordanade 0
  • Broken minification (`ParseError`)

    Broken minification (`ParseError`)

    What is this feature about (expected vs actual behaviour)?

    Should minify HTML, but throws ParseError

    How can I reproduce it?

    For testing purposes, I installed latest version and used the example in README, which throws same ParseError as seen in https://github.com/afbora/kirby-blade/issues/22

    Does it take minutes, hours or days to fix?

    I guess .. minutes?

    Any additional information?

    I really like your project

    opened by S1SYPHOS 0
  • `doMakeSameDomainsLinksRelative` somewhat counter-intuitive

    `doMakeSameDomainsLinksRelative` somewhat counter-intuitive

    What is this feature about (expected vs actual behaviour)?

    While all options receive bool (which is intuitive, because their name suggests that you DO it or you DO NOT do it), doMakeSameDomainsLinksRelative receives an array while also being named do(...). This might lead to some confusion (plus TypeError).

    I guess changing its name to something like makeSameDomainsLinksRelative could work, but ultimately, the desired array would be better off as global object $this->sameDomains (array) being set by setSameDomains (or whatever) containing the logic doMakeSameDomainsLinksRelative contains right now - so when 'activating' the option via doMakeSameDomainsLinksRelative, this would receive a bool.

    How can I reproduce it?

    Thinking about the naming convention - and eventually passing bool to function doMakeSameDomainsLinksRelative.

    Does it take minutes, hours or days to fix?

    Me: Hours You: Seconds :smile:

    Any additional information?

    It's rather the observation of a (tiny) inconsistency rather than a real problem, I totally get that, anyway I thought it's something to think about and make an informed decision :fox_face:

    opened by S1SYPHOS 0
Owner
Lars Moelleken
Webdeveloper & Sysadmin | egrep '#php|#js|#html|#css|#sass'
Lars Moelleken
Extensive, portable and performant handling of UTF-8 and grapheme clusters for PHP

Patchwork UTF-8 for PHP Patchwork UTF-8 gives PHP developpers extensive, portable and performant handling of UTF-8 and grapheme clusters. It provides

Nicolas Grekas 80 Sep 28, 2022
php-crossplane - Reliable and fast NGINX configuration file parser and builder

php-crossplane Reliable and fast NGINX configuration file parser and builder ℹ️ This is a PHP port of the Nginx Python crossplane package which can be

null 19 Jun 30, 2022
A tiny PHP class-based program to analyze an input file and extract all of that words and detect how many times every word is repeated

A tiny PHP class-based program to analyze an input file and extract all of that words and detect how many times every word is repeated

Max Base 4 Feb 22, 2022
PHP library to detect and manipulate indentation of strings and files

indentation PHP library to detect and manipulate the indentation of files and strings Installation composer require --dev colinodell/indentation Usage

Colin O'Dell 34 Nov 28, 2022
A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

The ability to encode and decode a certain set of characters called 'Html Entities' has existed since PHP4. Amongst the vast number of functions built into PHP, there are 4 nearly identical functions that are used to encode and decode html entities; despite their similarities, however, 2 of them do provide additional capabilities not available to the others.

Gavin G Gordon (Markowski) 2 Nov 12, 2022
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.

DeviceDetector Code Status Description The Universal Device Detection library that parses User Agents and detects devices (desktop, tablet, mobile, tv

Matomo Analytics 2.4k Jan 5, 2023
Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way.

String Component The String component provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a un

Symfony 1.3k Dec 29, 2022
A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.

SqlFormatter A lightweight php class for formatting sql statements. It can automatically indent and add line breaks in addition to syntax highlighting

Jeremy Dorn 3.9k Jan 1, 2023
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

URLify for PHP A fast PHP slug generator and transliteration library, started as a PHP port of URLify.js from the Django project. Handles symbols from

Aband*nthecar 667 Dec 20, 2022
ColorJizz is a PHP library for manipulating and converting colors.

#Getting started: ColorJizz-PHP uses the PSR-0 standards for namespaces, so there should be no trouble using with frameworks like Symfony 2. ###Autolo

Mikeemoo 281 Nov 25, 2022
A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.

SqlFormatter A lightweight php class for formatting sql statements. It can automatically indent and add line breaks in addition to syntax highlighting

Jeremy Dorn 3.9k Jan 3, 2023
Tutorial for computer vision and machine learning in PHP 7/8 by opencv (installation + examples + documentation)

Examples detect face by cascade classifier detect face by pretrained caffe model res10_300x300_ssd by ddn module detect facemarks by LBF algorithm rec

null 409 Dec 25, 2022
"結巴"中文分詞:做最好的 PHP 中文分詞、中文斷詞組件。 / "Jieba" (Chinese for "to stutter") Chinese text segmentation: built to be the best PHP Chinese word segmentation module.

jieba-php "結巴"中文分詞:做最好的 PHP 中文分詞、中文斷詞組件,目前翻譯版本為 jieba-0.33 版本,未來再慢慢往上升級,效能也需要再改善,請有興趣的開發者一起加入開發!若想使用 Python 版本請前往 fxsjy/jieba 現在已經可以支援繁體中文!只要將字典切換為 bi

Fukuball Lin 1.2k Dec 31, 2022
highlight.php is a server-side syntax highlighter written in PHP that currently supports 185 languages

highlight.php is a server-side syntax highlighter written in PHP that currently supports 185 languages. It's a port of highlight.js by Ivan Sagalaev that makes full use of the language and style definitions of the original JavaScript project.

Geert Bergman 633 Dec 27, 2022
Converts a string to a slug. Includes integrations for Symfony, Silex, Laravel, Zend Framework 2, Twig, Nette and Latte.

cocur/slugify Converts a string into a slug. Developed by Florian Eckerstorfer in Vienna, Europe with the help of many great contributors. Features Re

Cocur 2.8k Dec 22, 2022
Library for free use Google Translator. With attempts connecting on failure and array support.

GoogleTranslateForFree Packagist: https://packagist.org/packages/dejurin/php-google-translate-for-free Library for free use Google Translator. With at

Yurii De 122 Dec 23, 2022
Convert strings between 13 naming conventions: Snake case, Camel case, Kebab case, Pascal case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Title case, Sentence case and Dot notation.

Case converter Use this library to convert string between: Name Method Output example ?? Camel case toCamel() myNameIsBond ??‍?? Pascal case toPascal(

Jawira Portugal 147 Dec 24, 2022
Highlight trailing spaces and delete them in a flash.

Trailing Spaces A Sublime Text plugin that allows you to… highlight trailing spaces and delete them in a flash! Synopsis Installation Alternative inst

Sublime Text Packages 884 Jan 4, 2023
Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Motto: "Every business should have a detection script to detect mobile readers." About Mobile Detect is a lightweight PHP class for detecting mobile d

Şerban Ghiţă 10.2k Jan 4, 2023