2017 © Pedro Peláez
 

library bridge

A php package to share data from your back end code to the front end

image

coreplex/bridge

A php package to share data from your back end code to the front end

  • Monday, January 23, 2017
  • by michaeljennings
  • Repository
  • 3 Watchers
  • 0 Stars
  • 1,009 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

Bridge Build Status Latest Stable Version License

Ever found yourself needing to access back end data in your JavaScript or front end code? Well that's the aim of this package., (*1)

Installation

This package requires PHP 5.4+, and includes a Laravel 5 Service Provider and Facade., (*2)

We recommend installing the package through composer. You can either call composer require coreplex/notifier in your command line, or add the following to your composer.json and then run either composer install or composer update to download the package., (*3)

"coreplex/bridge": "~0.1"

Laravel 5 Integration

To use the package with Laravel 5 firstly add the javascript service provider to the list of service providers in app/config/app.php., (*4)

'providers' => array(

  Coreplex\Bridge\JavascriptServiceProvider::class,

);

If you wish to use the facade then add the following to your aliases array in app/config/app.php., (*5)

'aliases' => array(

  'Javascript'  => Coreplex\Bridge\Facades\Javascript::class,

);

Usage

To get started with the JavaScript component you simply need to create a new instance of the Javascript class., (*6)

$bridge = new Javascript();

Or if you are using laravel then you can access the class via it's facade or you can resolve it from the IOC container by its contract., (*7)

Javascript::share('foo, 'bar');

public function __construct(Coreplex\Bridge\Contracts\Javascript $bridge)
{
    $this->bridge = $bridge;
}

Sharing Data

To share data to the front end use the share method. You can either pass a key and value as arguments or pass an array of key value pairs. The share method can also be chained if you prefer., (*8)

$bridge->share('foo', 'bar')->share('baz', 'qux');
// OR
$bridge->share(['foo' => 'bar', 'baz' => 'qux']);

Rendering Data

To access your shared data on the front end call the renderSharedData method. This will then echo out all of the necessary scripts., (*9)

echo $bridge->renderSharedData();

The Versions

23/01 2017

dev-master

9999999-dev

A php package to share data from your back end code to the front end

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Michael Jennings
by Avatar Coreplex

laravel

23/01 2017

v0.2.0

0.2.0.0

A php package to share data from your back end code to the front end

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Michael Jennings
by Avatar Coreplex

laravel

19/09 2015

v0.1.2

0.1.2.0

A php package to share data from your back end code to the front end

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Michael Jennings
by Avatar Coreplex

laravel

24/08 2015

0.1.1

0.1.1.0

A php package to share data from your back end code to the front end

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Michael Jennings
by Avatar Coreplex

laravel

13/04 2015

0.1

0.1.0.0

A php package to share data from your back end code to the front end

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Michael Jennings
by Avatar Coreplex

laravel