marceloxp/php-es6-detect

This package is abandoned and no longer maintained. No replacement package was suggested.

Class PHP to Browser ES6 compatibility detect

dev-master / 1.5.x-dev 2018-07-03 14:47 UTC

This package is auto-updated.

Last update: 2022-09-14 07:22:57 UTC


README

Class PHP to Browser ES6 compatibility detect

Installation

Composer

composer require marceloxp/php-es6-detect

OR

Add directly to your composer.json

"require": {
    "marceloxp/php-es6-detect": "^1.0.0"
},

Usage

Option 1

use \marceloxp\PhpEs6Detect;
PhpEs6Detect::setScriptFolder();
<script type="text/javascript" src="<?php echo JSFOLDER; ?>/main.js"></script>

Option 2

use \marceloxp\PhpEs6Detect;
PhpEs6Detect::setScriptFolder('MYJSFOLDER', 'scripts', 'es6');
<script type="text/javascript" src="<?php echo MYJSFOLDER; ?>/main.js"></script>

Result Script

// Case ES6 suport:
<script type="text/javascript" src="es6/main.js"></script>
// Old browsers:
<script type="text/javascript" src="scripts/main.js"></script>