marceloxp / php-es6-detect
Class PHP to Browser ES6 compatibility detect
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7.0.0
- cbschuld/browser.php: 1.95-dev
Requires (Dev)
- digitalnature/php-ref: dev-master
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>