2017 © Pedro Peláez
 

library php-to-javascript-variables

image

rosio/php-to-javascript-variables

  • Wednesday, July 8, 2015
  • by ben-rosio
  • Repository
  • 1 Watchers
  • 1 Stars
  • 142 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

PHP To JavaScript Variables

Build Status, (*1)

Simple package which allows easy sharing of variables from PHP to JavaScript. This is a rewrite of the laracasts/utilities package. I was prompted to do this due to the aformentioned package requiring PHP 5.4+, and I disliked their design., (*2)

Installation

composer.json, (*3)

"require": {
    ...
    "rosio/php-to-javascript-variables": "~1.0"
}

config/app.php, (*4)

'providers' => array(

    ...
    'Rosio\PhpToJavaScriptVariables\PhpToJavaScriptVariablesServiceProvider',

),

Usage

controllers\HomeController.php, (*5)

    public function showWelcome()
    {
        JSLocalize::put(array(
            'variableName' => 'variableValue',
            'anotherVariable' => array(1, 2, 3)
        ));

        return View::make('hello');
    }

views\hello.php, (*6)

<!doctype html>
<html lang="en">
<head>
    ...
    {{ App::make('JSLocalizeDumper')->dump() }}
    ...
</head>
<body>

    <script type="text/javascript">
        alert(app.variableName);
    </script>
</body>
</html>

The Versions

08/07 2015

dev-master

9999999-dev

  Sources   Download

The Requires

 

by Avatar Ben

18/06 2014

dev-development

dev-development

  Sources   Download

The Requires

 

by Avatar Ben

18/06 2014

v1.0.1

1.0.1.0

  Sources   Download

The Requires

 

by Avatar Ben

14/06 2014

v1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by Avatar Ben

28/05 2014

v0.0.2

0.0.2.0

  Sources   Download

The Requires

 

by Avatar Ben

05/05 2014

v0.0.1

0.0.1.0

  Sources   Download

The Requires

 

by Avatar Ben